pvid更改后vg恢复

  • 格式:pdf
  • 大小:246.45 KB
  • 文档页数:11

PVID更改后恢复vg信息。

当我们创建vg后,已投入使用。

如果一不小心使用了chdev -l hdiskX –a pv=clear时这样我们vg就无法使用。

在san环境中,两台服务器共享san存储时,有时会碰到同一块共享盘在两台服务器上的PVID不一致。

如下我们测试下PVID号更改后恢复VG信息。

一,当前试验环境# df -gFilesystem GB blocks Free %Used Iused %Iused Mounted on/dev/hd4 2.00 1.82 9% 10082 3% //dev/hd2 4.00 1.86 54% 44950 10% /usr/dev/hd9var 0.50 0.15 71% 8342 19% /var/dev/hd3 10.00 10.00 1% 31 1% /tmp/dev/hd1 0.06 0.06 1% 5 1% /home/dev/hd11admin 0.12 0.12 1% 5 1% /admin/proc - - - - - /proc/dev/hd10opt 0.44 0.19 57% 8978 17% /opt/dev/livedump 0.25 0.25 1% 4 1% /var/adm/ras/livedump/dev/testlv 0.31 0.31 1% 4 1% /test/dev/test1lv 0.31 0.31 1% 4 1% /test1# lspvhdisk0 00f68967c64b4ee3 rootvg active hdisk1 00f689670470b37c test active # lsvg -l testtest:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINTtestlv jfs2 10 10 1 open/syncd /testtest1lv jfs2 10 10 1 open/syncd /test1loglv00 jfs2log 1 1 1 open/syncd N/A# pwd/test# ls -ltotal 8-rw-r--r-- 1 root system 331 Jul 22 12:58 chpviddrwxr-xr-x 2 root system 256 Jul 22 10:58 lost+found# lspvhdisk0 00f68967c64b4ee3 rootvg active hdisk1 00f689670470b37c test active---ODM库的信息# lqueryvg -Atp hdisk1Max LVs: 256PP Size: 25Free PPs: 938LV count: 3PV count: 1Total VGDAs: 2Conc Allowed: 0MAX PPs per PV: 1016MAX PVs: 32Quorum (disk): 1Quorum (dd): 1Auto Varyon ?: 1Conc Autovaryon 0Varied on Conc: 0Logical: 00f6896700004c00000001400470b497.1 testlv 1 00f6896700004c00000001400470b497.2 test1lv 1 00f6896700004c00000001400470b497.3 loglv00 1 Physical: 00f689670470b37c 2 0 --VGDA Total PPs: 959LTG size: 128HOT SPARE: 0AUTO SYNC: 0VG PERMISSION: 0SNAPSHOT VG: 0IS_PRIMARY VG: 0PSNFSTPP: 4352VARYON MODE: 0VG Type: 0Max PPs: 32512Mirror Pool Str nSys Mgt Mode: 0VG Reserved: 1PV RESTRICTION: 0Infinite Retry: 2# lquerypv -H /dev/hdisk100f689670470b37c0000000000000000 ---PV头(这三个地方一致)二,破坏测试# umount /test# umount /test1# varyoffvg test# lspvhdisk0 00f68967c64b4ee3 rootvg active hdisk1 00f689670470b37c test # chdev -l hdisk1 -a pv=clearhdisk1 changed# lspvhdisk0 00f68967c64b4ee3 rootvg active hdisk1 none None # chdev -l hdisk1 -a pv=yeshdisk1 changed# lspvhdisk0 00f68967c64b4ee3 rootvg active hdisk1 00f6896704c859f3 None # importvg -y test hdisk10516-360 getvgname: The device name is already used; choose adifferent name.0516-776 importvg: Cannot import hdisk1 as test.# lsvgrootvgtest# exportvg test# importvg -y test hdisk10516-1939 : PV identifier not found in VGDA.0516-780 importvg: Unable to import volume group from hdisk1.# lqueryvg -Atp hdisk10516-320 lqueryvg: Physical volume hdisk1 is not assigned toa volume group.Max LVs: 256PP Size: 25Free PPs: 938LV count: 3PV count: 1Total VGDAs: 2Conc Allowed: 0MAX PPs per PV: 1016MAX PVs: 32Quorum (disk): 1Quorum (dd): ???????Auto Varyon ?: 1Conc Autovaryon 0Varied on Conc: 0Logical: 00f6896700004c00000001400470b497.1 testlv 100f6896700004c00000001400470b497.2 test1lv 100f6896700004c00000001400470b497.3 loglv00 1Physical: 00f689670470b37c 2 0Total PPs: 959LTG size: 128HOT SPARE: 0AUTO SYNC: 0VG PERMISSION: 0SNAPSHOT VG: 0IS_PRIMARY VG: 0PSNFSTPP: 4352VARYON MODE: ???????VG Type: 0Max PPs: 32512Mirror Pool Str nSys Mgt Mode: ???????VG Reserved: ???????PV RESTRICTION: ???????Infinite Retry: 2# lquerypv -H /dev/hdisk100f6896704c859f30000000000000000# lquerypv -h /dev/hdisk1 80 1000000080 00F68967 04C859F3 00000000 00000000 |...g..Y.........|可以看到以上ODM库及磁盘头的PVID号与VGDA中不致,导致importvg无法完成。

三,恢复vg信息1,重写磁盘头用lquerypv –Atp hdisk1可以看VGDA中PVID号是00f689670470b37c这是16进制的换算成8进制手动换算00 0000f6 11,110,110=36689 10,001,001=21167 01,100,111=14704 00,000,100=00470 01,110,000=160b3 10,110,011=2637c 01,111,100=174也可以用bc命令换算# bcibase=16obase=800F6366892116714704470160B32637C174写放磁盘头echo "\0000\0366\0211\0147\0004\0160\0263\0174\c" | dd of=/dev/hdisk1 bs=1seek=128# echo "\0000\0366\0211\0147\0004\0160\0263\0174\c" | dd of=/dev/hdisk1 bs=1seek=1288+0 records in.8+0 records out.# lspvhdisk0 00f68967c64b4ee3 rootvg active hdisk1 00f6896704c859f3 None # lquerypv -H /dev/hdisk100f689670470b37c0000000000000000可以看到磁盘头的PVID已更改删除再cfgmgr使用ODM的PVID正确# rmdev -Rdl hdisk1hdisk1 deleted# cfgmgr# lspvhdisk0 00f68967c64b4ee3 rootvg active hdisk1 00f689670470b37c None#可以看到已找回Infinite Retry: 2# importvg -y test hdisk1test# lquerypv -Atp hdisk10516-162 lquerypv: VG identifier or PV name not entered.Usage: lquerypv [-h /dev/PVname] | [-p PVid [-g VGid | -N PVname] [-scPnaDdAtY]]# lqueryvg -Atp hdisk1Max LVs: 256PP Size: 25Free PPs: 938LV count: 3PV count: 1Total VGDAs: 2Conc Allowed: 0MAX PPs per PV: 1016MAX PVs: 32Quorum (disk): 1Quorum (dd): 1Auto Varyon ?: 1Conc Autovaryon 0Varied on Conc: 0Logical: 00f6896700004c00000001400470b497.1 testlv 100f6896700004c00000001400470b497.2 test1lv 100f6896700004c00000001400470b497.3 loglv00 1Physical: 00f689670470b37c 2 0Total PPs: 959LTG size: 128HOT SPARE: 0AUTO SYNC: 0VG PERMISSION: 0SNAPSHOT VG: 0IS_PRIMARY VG: 0PSNFSTPP: 4352VARYON MODE: 0VG Type: 0Max PPs: 32512Mirror Pool Str nSys Mgt Mode: 0VG Reserved: 1PV RESTRICTION: 0Infinite Retry: 2# lspvhdisk0 00f68967c64b4ee3 rootvg active hdisk1 00f689670470b37c test active # lsvg -l testtest:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINTtestlv jfs2 10 10 1 closed/syncd /fs/testtest1lv jfs2 10 10 1 closed/syncd /fs/test1loglv00 jfs2log 1 1 1 closed/syncd N/A这找回vg回文件系统会以/fs开回这要更改/etc/filesystems文件中的字段# lsvg -l testtest:LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT testlv jfs2 10 10 1 closed/syncd /testtest1lv jfs2 10 10 1 closed/syncd /test1loglv00 jfs2log 1 1 1 closed/syncd N/A# mount /test# mount /test1# df -gFilesystem GB blocks Free %Used Iused %Iused Mounted on/dev/hd4 2.00 1.82 9% 10083 3% //dev/hd2 4.00 1.86 54% 44950 10% /usr/dev/hd9var 0.50 0.15 71% 8344 19% /var/dev/hd3 10.00 10.00 1% 35 1% /tmp/dev/hd1 0.06 0.06 1% 5 1% /home/dev/hd11admin 0.12 0.12 1% 5 1% /admin/proc - - - - - /proc/dev/hd10opt 0.44 0.19 57% 8978 17% /opt/dev/livedump 0.25 0.25 1% 4 1% /var/adm/ras/livedump /dev/testlv 0.31 0.31 1% 5 1% /test/dev/test1lv 0.31 0.31 1% 4 1% /test1# cd /test# lschpvid lost+found可以看到数据一切正常。