Linux|系统管理|WEB开发

关注Linux,系统管理,WEB开发以及开源世界

Reuses an Existing Logical Volume Number

| Comments

不知道前因后果(大部分情况下,用户都这么描述),重启机器后,发现逻辑卷有问题,执行pvscan的结果是这样的:

# pvscan
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- inactive PV "/dev/sdb1" of VG "ora_yz" [49.94 GB / 17.81 GB
free]
pvscan -- inactive PV "/dev/sdc1" of VG "ora_yz2" [99.94 GB / 6 GB
free]
pvscan -- inactive PV "/dev/sdd" is associated to unknown VG
"ora_yz2_02" (run vgscan)
pvscan -- ACTIVE PV "/dev/sde1" of VG "ora_yz" [49.94 GB / 17.81 GB
free]
pvscan -- ACTIVE PV "/dev/sdf1" of VG "ora_yz2" [99.94 GB / 6 GB free]
pvscan -- inactive PV "/dev/sdg" is associated to unknown VG
"ora_yz2_02" (run vgscan)
pvscan -- total: 6 [580 GB] / in use: 6 [580 GB] / in no VG: 0 [0]

上面已经说名为ora_yz2_02的VG出现问题了,继续vgscan,给出的结果如下:

# vgscan
vgscan -- reading all physical volumes (this may take a while...)
vgscan -- found active volume group "ora_yz"
vgscan -- found active volume group "ora_yz2"
vgscan -- found inactive volume group "ora_yz2_02"
vgscan -- volume group "ora_yz2_02" reuses an existing logical volume
number;
 please vgexport/vgimport that VG or use option -f

vgscan -- "/etc/lvmtab" and "/etc/lvmtab.d" successfully created
vgscan -- WARNING: This program does not do a VGDA backup of your volume
groups

上面的描述信息似乎是说ora_yz2_02这个VG重复使用了一个逻辑卷号(logical volume number),不太理解这个逻辑卷号是什么意思,google一下,也没有找到有价值的消息。

当然解决办法很简单,按照屏幕的提示执行vgscan -f 就好了。

不过我我查询了vgscan的联机手册,并没有发现这个-f的参数,不知道这个-f,是不是–force的意思,从源代码着手吧,结果源代码里vgscan命令中也没有这个参数。

于是打电话给去解决这个问题的同事,询问是不是使用的vgscan -f 解决的,得到肯定的答复后,我突然想起一件事情,马上询问,操作系统是什么版本,结果是redflag dc4.1,原来是LVM,而不是LVM2,想当然的把它当作了LVM2,浪费了不少时间,LVM1中vgscan确实有-f这个参数,是--forcenumbers的意思。其man手册这么描述的(vgscan(8))

If used volume group and/or logical volume minor numbers are found during scan, replace them. This will potentially cause problems for NFS exported filesystems on logical volumes with changed numbers.

不是能很好的理解这句话的意思,主要是不知道为什么会出现这种情况,不过这里有篇文章提到了如何找到这个谁使用了LV或者VG的minor number的方法。不过是针对HP-UX,不知道是不是适应Linux,下次如果再遇到这类问题,应该好好折腾一下。这次算是没有机会了。

Comments