Chinaunix首页 | 论坛 | 博客
  • 博客访问: 131071
  • 博文数量: 12
  • 博客积分: 2040
  • 博客等级: 大尉
  • 技术积分: 370
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-29 14:50
文章分类

全部博文(12)

文章存档

2011年(1)

2009年(3)

2008年(8)

我的朋友

分类:

2009-05-20 08:46:22

 

Pvid是aix系统中的ODM LVM用于识别PV的序列号,操作系统通过pvid来识别pv,就好像我们每个人的ID card。

当pv被添加到系统中之后,可以通过两种方式生成pvid

1,cfgmgr -v
2,lspv 如果没有PVID的话,执行chdev -l hdiskn -a pv=yes

也就是说当系统可以识别硬盘 并将硬盘认可为pv(即lvm的组件)的时候。系统就分配了pvid给硬盘,系统的odm库中保存有pvid。
Pvid的生成原则是 主板序列号+形成pv时候的时间戳,pvid除了写入odm库,在硬盘头信息里(0扇区的头几个字节)以及VGDA 也将写入pvid

To make a disk into a physical volume, the PVID is placed onto the disk. ThePVID is an combination of the machine's serial number (from the systems EPROMs) and the date the PVID was generated. This combination ensures the extremely low chance of PVIDs being duplicated. When the system is booted, the disk configurator looks at the PVID residing on the disk and compares it with an entry in the ODM. If an entry is found, then the disk is given the hdiskx number in the ODM that is associated with the PVID. If there is no matching entry, then the next name in the pool of 'free' hdisk names is allocated to the physical volume.

可以通过 lquerypv -H hdisk0查看pv上的pvid

ibm150:[/]#lquerypv -H /dev/hdisk0
000af70de396426b0000000000000000
ibm150:[/]#lspv
hdisk0 000af70de396426b datavg
hdisk1 000af70d5c816fc2 rootvg
hdisk2 000af70d4d50358c rootvg

可以看到三个pv的pvid前几位数字是相同的(即主板序列号),后几位数字是不同的。

可以通过以下方法修改pvid
chdev -l hdisk1 -a pv=clear 清除pv 磁盘头的pvid
chdev -l hdisk1 -a pv=yes 重新定义pvid

如果pv已经加入卷组,首先还得先varyoffvg ,exportvg
执行以上步骤,pv的pvid将会改变。这里修改的只是磁盘头的pvid,并没有修改vgda中的pvid


当pv已经是一个卷组的成员时,切记不要随便修改pvid

因为当pv加入一个卷组的时候,pvid将被写入vgda,如果你擅自修改卷组的pvid,然后新生成的pvid将不能和卷组vgda中的pvid相匹配,这样就无法importvg,就无法varyonvg,很有可能就会丢失数据!

当importvg的时候,odm将读取pv上的vgda,如果vgda上pvid与自身磁盘上的pvid不符合的话,将出现错误!


注意:当pv加入卷组以后,pvid在硬盘上存在于至少两个地方,一个是在硬盘头,一个是在vgda中。这两个地方的pvid一般是相同的,但是由于pvid的修改,可能造成不一致,这样就有可能丢失数据。

你可以通过
#lqueryvg -Atp hdisk0 查看pv vgda中的pvid

ibm150:[/]#lqueryvg -Atp hdisk0
Max LVs: 256
PP Size: 25
Free PPs: 85
LV count: 3
PV count: 1
Total VGDAs: 2
Conc Allowed 0
MAX PPs per 1016
MAX PVs: 32
Conc Autovar 0
Varied on Co 0
Logical: 000af70d00004c0000000106e3964781.1 loglv00 1
000af70d00004c0000000106e3964781.2 lv00 1
000af70d00004c0000000106e3964781.3 lv02 1
Physical: 000af70de396426b 2 0
Total PPs: 542
LTG size: 128
HOT SPARE: 0
AUTO SYNC: 0
VG PERMISSIO 0

当然万一修改了,还是有办法恢复数据的!
1, 修复卷组(推荐)
1.首先将原卷组的定义从系统的ODM库中删除:
# exportvg vgname

2.检查硬盘上VGDA 区的信息,从中得到有关逻辑卷的名称及定义:
如:

#lqueryvg -Atp hdisk2
Max LVs: ------256
PP Size: ------26
Free PPs: -----538
LV count: -----2
PV count: -----1
Total VGDAs: --2
Conc Allowed --0
MAX PPs per ---1016
MAX PVs: ------32
Conc Autovar --0
Varied on Co --0
Logical: ------0003f62a00004c00000000f52f1737c5.1 --datalv1 1
---------------0003f62a00004c00000000f52f1737c5.2 --datalv2 1
Physical: -----0003f62a2f135f0e --------------2 ----0
Total PPs: ----542
LTG size: -----128
HOT SPARE: ----0
AUTO SYNC: ----0
VG PERMISSIO --0

3.创建逻辑卷名对应表文件。 第一字段为VGDA区中的逻辑卷的名,第二字段为在新卷组中新的逻辑卷名,可相同也可不同;为了修复原有卷组的内容,通常逻辑卷名保持不变。

如:

#vi /tmp/lvname
datalv1:datalv1
datalv2:datalv2

4. 在硬盘上重新创建卷组,保留原有卷组的数据结构。

#recreatevg -y vgname -l lv_file hdisk_name...
如:
#recreatevg -y testvg -l /tmp/lvname hdisk2

5. 如果卷组上有文件系统,还需修改 /etc/filesystems ,使对应的文件系统的加载点与原来的一致。首先修改/etc/filesystems文件,不行的话就执行下面的步骤
或者:

如果在重新import后,发现mountpoint不同,可以通过smitty chlv修改lv属性,即修改Logical volume LABEL,使之与mount point相同。

为什么要修改/etc/filesystem呢?

recreatevg 后,系统自动创建了目录/fs,所有的文件系统加载到了/fs下,原来的mountpoint是以/为基准的

阅读(1236) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~