====== Import / Export a volume group ======
== Import VG ==
On AIX, if you want to import datas from another server, you can assign all disk from a VG to the new target host, and import the VG.
Before importing a VG, you can check which logical volume definition it contain:
[root@lpar01:/root]# cfgmgr
[root@lpar01:/root]# lspv
hdisk0 00c1f170c2c44e75 rootvg active
hdisk1 00f69af6dbccc5ed None
hdisk2 00f69af6dbccc57f None
Now, the system shows two more disks, but one volume group.
Confirm the contents of the disks before assuming they are not in use.
[root@lpar01:/root]# lqueryvg -p hdisk1 -L
00c1f17000004c0000000130095dd271.1 db2bin 1
00c1f17000004c0000000130095dd271.2 loglv00 1
00c1f17000004c0000000130095dd271.3 data1lv 1
00c1f17000004c0000000130095dd271.4 data2lv 1
00c1f17000004c0000000130095dd271.5 data1lg 1
00c1f17000004c0000000130095dd271.6 data1tmp 1
[root@lpar01:/root]# lqueryvg -Atp hdisk1
0516-320 lqueryvg: Physical volume hdisk1 is not assigned to
a volume group.
0516-066 lqueryvg: Physical volume is not a volume group member.
Check the physical volume name specified.
[root@lpar01:/root]# lqueryvg -Atp hdisk2
0516-320 lqueryvg: Physical volume hdisk2 is not assigned to
a volume group.
Max LVs: 256
PP Size: 25
Free PPs: 311
LV count: 6
PV count: 1
Total VGDAs: 2
Conc Allowed: 0
MAX PPs per PV 32768
MAX PVs: 1024
Quorum (disk): 1
Quorum (dd): 1
Auto Varyon ?: 0
Conc Autovaryo 0
Varied on Conc 0
Logical: 00c1f17000004c0000000130095dd271.1 db2bin 1
00c1f17000004c0000000130095dd271.2 loglv00 1
00c1f17000004c0000000130095dd271.3 data1lv 1
00c1f17000004c0000000130095dd271.4 data2lv 1
00c1f17000004c0000000130095dd271.5 data1lg 1
00c1f17000004c0000000130095dd271.6 data1tmp 1
Physical: 00f69af6dbccc57f 2 0
Total PPs: 317
LTG size: 128
HOT SPARE: 0
AUTO SYNC: 0
VG PERMISSION: 0
SNAPSHOT VG: 0
IS_PRIMARY VG: 0
PSNFSTPP: 140288
VARYON MODE: ???????
VG Type: 2
Max PPs: 32768
Mirror Pool St n
You can see that there is only LV on the disk hdisk2, then you can import the VG to access the datas (with importvg command, you have **only one disk** to specify, and AIX will retrieve all disks belonging to that VG)
[root@lpar01:/root]# importvg -y testvg hdisk2
datavg
[root@lpar01:/root]# lspv
hdisk0 00c1f170c2c44e75 rootvg active
hdisk1 00f69af6dbccc5ed None
hdisk2 00f69af6dbccc57f datavg active
Now you can mount all filesystems from testvg
== Exportvg command ==
If you want to suppress a VG definition from your system, all LV from this VG must be closed, and the VG must be varyoff.
Then AIX will only remove the VG definition without affecting datas.
Exportvg/importvg is the only way to rename a VG.
== Read PVID on a disk ==
[root@lpar01:/root]# lquerypv -h /dev/hdisk0 80 10
00000080 00C4489D 5E6002A5 00000000 00000000 |..H.^`..........|
[root@lpar01:/root]# lspv
hdisk0 00c4489d5e6002a5 rootvg active