测试环境:aix 7100-03-03-1415
1.测试-使用testvg,testvg已经创建文件系统并存放数据
# lspv
hdisk0 00c68ebbc8661d02 rootvg active
hdisk1 00c68ebb6f10eb15 testvg active
hdisk2 00c68ebb8de4c792 testvg active
hdisk3 none None
# lsvg -l testvg
testvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
loglv00 jfs2log 1 1 1 open/syncd N/A
fslv00 jfs2 4 4 1 open/syncd /test
# cd /test
# ls -l
total 0
drwxr-xr-x 2 root system 256 Jun 26 13:11 abc
drwxr-xr-x 2 root system 256 Jun 26 13:10 lost+found
# cd abc
# ls -l
total 8
-rw-r--r-- 1 root system 23 Jun 26 13:11 test.txt
# cat test.txt
This is a test file!!!
2.以hdisk2为例,先列出hdisk2的pvid信息
hdisk2在ODM中的信息
# lspv
hdisk0 00c68ebbc8661d02 rootvg active
hdisk1 00c68ebb6f10eb15 testvg active
hdisk2 00c68ebb8de4c792 testvg active
hdisk3 none None
hdisk2在VGDA中的信息
# lqueryvg -Atp hdisk2
Max LVs: 256
PP Size: 27
Free PPs: 1634
LV count: 2
PV count: 2
Total VGDAs: 3
Conc Allowed: 0
MAX PPs per PV: 32768
MAX PVs: 1024
Quorum (disk): 1
Quorum (dd): 1
Auto Varyon ?: 2
Conc Autovaryon 0
Varied on Conc: 0
Logical: 00c68ebb00004c00000001558de6cbe4.1 loglv00 1
00c68ebb00004c00000001558de6cbe4.2 fslv00 1
Physical: 00c68ebb6f10eb15 2 0
00c68ebb8de4c792 1 0
Total PPs: 1639
LTG size: 128
HOT SPARE: 0
AUTO SYNC: 0
VG PERMISSION: 0
SNAPSHOT VG: 0
IS_PRIMARY VG: 0
PSNFSTPP: 139520
VARYON MODE: 0
VG Type: 2
Max PPs: 32768
Mirror Pool Str n
Sys Mgt Mode: 0
VG Reserved: 1
PV RESTRICTION: 0
Infinite Retry: 2
Varyon State: 0
Disk Block Size 512
hdisk在盘头的信息显示
# lquerypv -H /dev/hdisk2
00c68ebb8de4c7920000000000000000
3.执行破坏测试
执行后,ODM库中的pvid发生了变化(蓝色部分)
# umount /test
# varyoffvg testvg
# chdev -l hdisk2 -a pv=clear
hdisk2 changed
# chdev -l hdisk2 -a pv=yes
hdisk2 changed
# lspv
hdisk0 00c68ebbc8661d02 rootvg active
hdisk1 00c68ebb6f10eb15 testvg
hdisk2 00c68ebb8df07242 None
hdisk3 none None
VGDA中的PVID信息并没有发生变化
# lqueryvg -Atp hdisk2
0516-320 lqueryvg: Physical volume hdisk2 is not assigned to
a volume group.
Max LVs: 256
PP Size: 27
Free PPs: 1634
LV count: 2
PV count: 2
Total VGDAs: 3
Conc Allowed: 0
MAX PPs per PV: 32768
MAX PVs: 1024
Quorum (disk): 1
Quorum (dd): ???????
Auto Varyon ?: 2
Conc Autovaryon 0
Varied on Conc: 0
Logical: 00c68ebb00004c00000001558de6cbe4.1 loglv00 1
00c68ebb00004c00000001558de6cbe4.2 fslv00 1
Physical: 00c68ebb6f10eb15 2 0
00c68ebb8de4c792 1 0
Total PPs: 1639
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
Disk Block Size 512
盘头的信息也发生了变化。
# lquerypv -H /dev/hdisk2
00c68ebb8df072420000000000000000
此时,激活卷组会报错
# varyonvg testvg
0516-510 varyonvg: Physical volume not found for physical volume
identifier 00c68ebb8de4c792.
4.重新将原有的PVID写入盘头
先把PVID:00c68ebb6f0db4c0转换成8进制数值,可以使用bc命令:
# bc
ibase=16
obase=8
00
0
C6
306
8E
216
BB
273
8D
215
E4
344
C7
307
92
222
转换完成后为:0000 0306 0216 0273 0215 0344 0307 0222
将数值写入盘头,命令如下:
# echo "\\0000\\0306\\0216\\0273\\0215\\0344\\0307\\0222\\c" | dd of=/dev/hdisk2 bs=1 seek=128
8+0 records in.
8+0 records out.
转换成功后,查询盘头,正常。 odm还是00c68ebb8df07242
# lquerypv -H /dev/hdisk2
00c68ebb8de4c7920000000000000000
# lspv
hdisk0 00c68ebbc8661d02 rootvg active
hdisk1 00c68ebb6f10eb15 None
hdisk2 00c68ebb8df07242 None
hdisk3 none None
此时,盘头和vgda的信息一致了(00c68ebb8de4c792 ),ODM还不一致
5.这时,激活卷组,还是会报错,删除磁盘重新识别
# rmdev -dl hdisk2
hdisk2 deleted
# cfgmgr
# lspv
hdisk0 00c68ebbc8661d02 rootvg active
hdisk1 00c68ebb6f10eb15 testvg
hdisk2 00c68ebb8de4c792 None
hdisk3 none None
6.重新导入vg,后成功。 检查数据
# exportvg testvg
# importvg -y testvg hdisk2
testvg
# lsvg -l testvg
testvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
loglv00 jfs2log 1 1 1 closed/syncd N/A
fslv00 jfs2 4 4 1 closed/syncd /test
# mount /test
# cd /test
# ls -l
total 0
drwxr-xr-x 2 root system 256 Jun 26 13:11 abc
drwxr-xr-x 2 root system 256 Jun 26 13:10 lost+found
# cd abc
# ls -l
total 8
-rw-r--r-- 1 root system 23 Jun 26 13:11 test.txt
# cat test.txt
This is a test file!!!
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞16
添加新评论1 条评论
2017-03-09 13:08