节点1
hdisk37 00cd1e1561f8761d yhvg
hdisk38 00cd1e1561f87765 yhvg
hdisk39 00cd1e1561f878c5 yhvg
hdisk40 00cd1e155b966d41 yhvg
hdisk41 00cd1e1557c0656e testvg
fbdb11:[/]#
fbdb11:[/]#lqueryvg -Atp hdisk40
Max LVs: 256
PP Size: 29
Free PPs: 754
LV count: 1
PV count: 4
Total VGDAs: 4
Conc Allowed: 0
MAX PPs per PV: 32768
MAX PVs: 1024
Quorum (disk): 1
Quorum (dd): ???????
Auto Varyon ?: 0
Conc Autovaryon 0
Varied on Conc: 0
Logical: 00cd1e1500004c000000015161f8795b.1 lv_yh 1
Physical: 00cd1e1561f8761d 1 0
00cd1e1561f87765 1 0
00cd1e1561f878c5 1 0
00cd1e155b966d41 1 0
Total PPs: 804
LTG size: 128
HOT SPARE: 0
AUTO SYNC: 0
VG PERMISSION: 0
SNAPSHOT VG: 0
IS_PRIMARY VG: 0
PSNFSTPP: 139520
VARYON MODE: ???????
VG Type: 2
Max PPs: 32768
Mirror Pool Str n
Sys Mgt Mode: ???????
VG Reserved: ???????
PV RESTRICTION: ???????
Infinite Retry: 2
Varyon State: 0
fbdb11:[/]#varyonvg yhvg
PV Status: hdisk37 00cd1e1561f8761d PVACTIVE
hdisk38 00cd1e1561f87765 PVACTIVE
hdisk39 00cd1e1561f878c5 PVACTIVE
hdisk40 00ccada466ea569d INVPVID
00cd1e155b966d41 NONAME
varyonvg: Volume group yhvg is varied on.
节点2
fbdb12:[/]#
hdisk37 00cd1e1561f8761d yhvg active
hdisk38 00cd1e1561f87765 yhvg active
hdisk39 00cd1e1561f878c5 yhvg active
hdisk40 00ccada466ea569d None
hdisk41 00ccada461f094ff None
fbdb12:[/]#lqueryvg -Atp hdisk40
0516-320 lqueryvg: Physical volume hdisk40 is not assigned to
a volume group.
Max LVs: 256
PP Size: 29
Free PPs: 754
LV count: 1
PV count: 4
Total VGDAs: 4
Conc Allowed: 0
MAX PPs per PV: 32768
MAX PVs: 1024
Quorum (disk): 1
Quorum (dd): ???????
Auto Varyon ?: 0
Conc Autovaryon 0
Varied on Conc: 0
Logical: 00cd1e1500004c000000015161f8795b.1 lv_yh 1
Physical: 00cd1e1561f8761d 1 0
00cd1e1561f87765 1 0
00cd1e1561f878c5 1 0
00cd1e155b966d41 1 0
Total PPs: 804
LTG size: 128
HOT SPARE: 0
AUTO SYNC: 0
VG PERMISSION: 0
SNAPSHOT VG: 0
IS_PRIMARY VG: 0
PSNFSTPP: 139520
VARYON MODE: ???????
VG Type: 2
Max PPs: 32768
Mirror Pool Str n
Sys Mgt Mode: ???????
VG Reserved: ???????
PV RESTRICTION: ???????
Infinite Retry: 2
Varyon State: 0
fbdb12:[/]#
问题:
现在两个节点hdisk40 PVID不同,创建卷组时的PVID都原始PVID是现在节点1上hdisk40的PVID 00cd1e155b966d41 ,节点2上的hdisk40本来也是 00cd1e155b966d41 ,后来经过chdev -l hdisk40 -a pv=clear ,chdev -l hdisk40 -a pv=yes之后,PVID已发生改变。现在在节点2上激活卷组yhvg是会报错且不能包括hdisk40,
fbdb12:[/]#varyonvg yhvg
PV Status: hdisk37 00cd1e1561f8761d PVACTIVE
hdisk38 00cd1e1561f87765 PVACTIVE
hdisk39 00cd1e1561f878c5 PVACTIVE
00cd1e155b966d41 NONAME
varyonvg: Volume group yhvg is varied on.
fbdb12:[/]#
hdisk37 00cd1e1561f8761d yhvg
hdisk38 00cd1e1561f87765 yhvg
hdisk39 00cd1e1561f878c5 yhvg
hdisk40 00ccada466ea569d None
尝试的操作:
1、
fbdb12:[/]#synclvodm -P -v yhvg 失败
0516-510 synclvodm: Physical volume not found for physical volume
identifier 00cd1e155b966d410000000000000000.
0516-548 synclvodm: Partially successful with updating volume
group yhvg.
synclvodm: Logical volume lv_yh updated.
2.、
fbdb12:[/]#redefinevg -d hdisk40 yhvg
0516-1939 : PV identifier not found in VGDA.
fbdb12:[/]#
希望高人指点下,这是测试环境,可以随便折腾。因为生产环境存在类似的问题,所以急需找到相应都解决方案。谢谢。
在节点2上执行如下脚本
pvid=00cd1e155b966d41
disk=hdisk40
set -A a `echo $pvid|\
awk \' {
for (f=1; f <= length($0); f=f+2) {
print \"ibase=16\nobase=8\n\"toupper(substr($0,f,2))
}
}\'|\
bc 2>/dev/null`
/usr/bin/echo \"\0\"${a[0]}\"\0\"${a[1]}\"\0\"${a[2]}\"\0\"${a[3]}\"\0\"\
${a[4]}\"\0\"${a[5]}\"\0\"${a[6]}\"\0\"${a[7]}\"\0\0\0\0\0\0\0\0\c\"|\
dd bs=1 seek=128 of=/dev/$disk
收起这个是个例子:
[test1:/]#chdev -l hdisk5 -a pv=clear
hdisk5 changed
[test1:/]#lspv
hdisk0 00c2c8724fe40e12 rootvg active
hdisk1 00c2c872071205fd test1vg active
hdisk2 00c2c872604e4d20 test2vg
hdisk3 00c2c8723c33abbf None
hdisk4 00c2c872605457f4 None
hdisk5 none None
hdisk6 00c2c8726f46381a heartvg
[test1:/]#chdev -l hdisk5 -a pv=yes
hdisk5 changed
[test1:/]#lspv
hdisk0 00c2c8724fe40e12 rootvg active
hdisk1 00c2c872071205fd test1vg active
hdisk2 00c2c872604e4d20 test2vg
hdisk3 00c2c8723c33abbf None
hdisk4 00c2c872605457f4 None
hdisk5 00c2c8723c469fbe None
hdisk6 00c2c8726f46381a heartvg
--注意看pvid已经改变了。vg也消失了。
[test1:/]#varyonvg sjhvg
0516-008 varyonvg: LVM system call returned an unknown
error code (3).
[test1:/]#varyonvg -b sjhvg
0516-008 varyonvg: LVM system call returned an unknown
error code (3).
[test1:/]#varyonvg -f sjhvg
0516-008 varyonvg: LVM system call returned an unknown
error code (3).
--vg已无法varyon。
[test1:/]#lqueryvg -Atp hdisk5
0516-320 lqueryvg: Physical volume hdisk5 is not assigned to
a volume group.
Max LVs: 256
PP Size: 23
Free PPs: 628
LV count: 2
PV count: 1
Total VGDAs: 2
Conc Allowed: 0
MAX PPs per PV 1016
MAX PVs: 32
Conc Autovaryo 0
Varied on Conc 0
Logical: 00c2c87200004c00000001203c374e76.1 sjhlv 1
00c2c87200004c00000001203c374e76.2 loglv02 1
Physical: 00c2c872605458d0 2 0
Total PPs: 639
LTG size: 128
HOT SPARE: 0
AUTO SYNC: 0
VG PERMISSION: 0
SNAPSHOT VG: 0
IS_PRIMARY VG: 0
PSNFSTPP: 4352
VARYON MODE: 0
VG Type: 0
Max PPs: 32512
--获取hdisk5 vgda的信息。
以下开始修复:
1.[test1:/]#exportvg sjhvg
2.创建逻辑卷名对应表文件。第一字段为VGDA区中的逻辑卷的名,第二字段为在新卷组中新的逻辑卷名,可相同也可不同;为了修复原有卷组的内容,通常逻辑卷名保持不变。
[test1:/tmp]#cat pvidfixlv
sjhlv:sjhlv
loglv02:loglv02
3.在硬盘上重新创建卷组,保留原有卷组的数据结构。
[test1:/tmp]#recreatevg -y sjhvg -l /tmp/pvidfixlv hdisk5
sjhvg
[test1:/tmp]#lsvg -o
sjhvg
test1vg
rootvg
4.修改/etc/filesystems
/fs/pvidtest:
dev = /dev/sjhlv
vfs = jfs2
log = /dev/loglv02
mount = false
check = false
options = rw
account = false
--recreatevg 后,系统自动创建了目录/fs,所有的文件系统加载到了/fs下,原来的mountpoint是以/为基准的。
[test1:/tmp]#lsvg -l sjhvg
sjhvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
sjhlv jfs2 10 10 1 closed/syncd /fs/pvidtest
loglv02 jfs2log 1 1 1 closed/syncd N/A
/pvidtest:
dev = /dev/sjhlv
vfs = jfs2
log = /dev/loglv02
mount = false
check = false
options = rw
account = false
--修改/etc/filesystems之后的样子。
[test1:/tmp]#mount /pvidtest
[test1:/tmp]#cd /pvidtest
[test1:/pvidtest]#ls
config.xml lost+found webAppConfig.xml
[test1:/pvidtest]#lsvg -l sjhvg
sjhvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
sjhlv jfs2 10 10 1 open/syncd /pvidtest
loglv02 jfs2log 1 1 1 open/syncd N/A
--文件都在,状态也都正常。修复完毕。
收起此问题已解决,我按照同事的指导把节点2的PVID修改和节点1的原始PVID值相同,节点2上能正常激活卷组及挂载文件系统。
#cat pvidchange.sh
pvid=00cd1e155b966d41
disk=hdisk40
set -A a `echo $pvid|\
awk \' {
for (f=1; f <= length($0); f=f+2) {
print \"ibase=16\nobase=8\n\"toupper(substr($0,f,2))
}
}\'|\
bc 2>/dev/null`
/usr/bin/echo \"\0\"${a[0]}\"\0\"${a[1]}\"\0\"${a[2]}\"\0\"${a[3]}\"\0\"\
${a[4]}\"\0\"${a[5]}\"\0\"${a[6]}\"\0\"${a[7]}\"\0\0\0\0\0\0\0\0\c\"|\
dd bs=1 seek=128 of=/dev/$disk
#cat chpvid
#!/usr/bin/ksh
pvid=$1
disk=$2
set -A a `echo $pvid|\
awk \' {
for (f=1; f <= length($0); f=f+2) {
print \"ibase=16\nobase=8\n\"toupper(substr($0,f,2))
}
}\'|\
bc 2>/dev/null`
/usr/bin/echo \"\0\"${a[0]}\"\0\"${a[1]}\"\0\"${a[2]}\"\0\"${a[3]}\"\0\"\
${a[4]}\"\0\"${a[5]}\"\0\"${a[6]}\"\0\"${a[7]}\"\0\0\0\0\0\0\0\0\c\"|\
dd bs=1 seek=128 of=/dev/$disk
#./chpvid 00cd1e155b966d41 hdisk40
#lqueryvg -AtP -p hdisk40
#lquerypv -h /dev/hdisk40
#rmdev -dl hdisk40
#cfgmrg -v
#在节点1上varyoffvg exportvg
#在节点2上importvg -y vgname hdisk40
收起