Hi,
Just a few notes on how to upgrade to lvm version 2.X on HP-UX 11.31 with the vgversion command, and also how to RESTORE your 1.X config so you can use the VG on 11.23.
First we can check, what VG versions we have on our system, usinf lvmadm command:
unix:/root# lvmadm -l
--- Version 1.0 volume groups ---
VG Name /dev/vg00
PV Name /dev/disk/disk9_p2
VG Name /dev/vgasm
PV Name /dev/dsk/c4t0d0
/dev/dsk/c6t0d0
/dev/disk/disk7
VG Name /dev/vgapli
PV Name /dev/disk/disk8
VG Name /dev/vgdocumentum
PV Name /dev/disk/disk10
LVM volume group version 2.0 was introduced on the March 2008 update of HP-UX 11i v3 and is available for all updates on HP 11i v3 going forward
At the moment all our VGs are on version 1.0, we needed to update /dev/vgdocumentum, so we check with lvmadm the lvm versions we can update to and their limits:
unix:/root# lvmadm -t
--- LVM Limits ---
VG Version 1.0
Max VG Size (Tbytes) 510
Max LV Size (Tbytes) 16
Max PV Size (Tbytes) 2
Max VGs 256
Max LVs 255
Max PVs 255
Max Mirrors 2
Max Stripes 255
Max Stripe Size (Kbytes) 32768
Max LXs per LV 65535
Max PXs per PV 65535
Max Extent Size (Mbytes) 256
VG Version 2.0
Max VG Size (Tbytes) 2048
Max LV Size (Tbytes) 256
Max PV Size (Tbytes) 16
Max VGs 512
Max LVs 511
Max PVs 511
Max Mirrors 5
Max Stripes 511
Max Stripe Size (Kbytes) 262144
Max LXs per LV 33554432
Max PXs per PV 16777216
Max Extent Size (Mbytes) 256
VG Version 2.1
Max VG Size (Tbytes) 2048
Max LV Size (Tbytes) 256
Max PV Size (Tbytes) 16
Max VGs 2048
Max LVs 2047
Max PVs 2048
Max Mirrors 5
Max Stripes 511
Max Stripe Size (Kbytes) 262144
Max LXs per LV 33554432
Max PXs per PV 16777216
Max Extent Size (Mbytes) 256
So we are going to migrate to VG version 2.1 using vgversion command that was introduced in the HP-UX 11i v3 March 2009 Update.
First we can run a check on the VG we want to upgrade, it does a preview of the upgrade and it tells us if the upgrade is posible, is the -r option in the vgversion command:
unix:/root# vgversion -v -r -V 2.1 /dev/vgdocumentum
Performing "vgchange -a r -l -p -s /dev/vgdocumentum" to collect data
Activated volume group.
Volume group "/dev/vgdocumentum" has been successfully activated.
Warning: Volume Group version 2.1 does not support bad block
relocation. The bad block relocation policy of all logical volumes
will be set to NONE.
Deactivating Volume Group "/dev/vgdocumentum"
Volume group "/dev/vgdocumentum" has been successfully deactivated.
Volume Group version can be successfully changed to 2.1
Review complete. Volume group not modified
Once the preview works fine we can umount the fs and deactivate the vg:
unix:/root# umount /documentum
unix:/root# umount /dctmindx
unix:/root# umount /dctmdata
unix:/root# vgchange -a n /dev/vgdocumentum
Volume group "/dev/vgdocumentum" has been successfully changed.
And finally run the vgversion command:
cceaunix:/root# vgversion -v -V 2.1 /dev/vgdocumentum
Performing "vgchange -a y -l -p -s /dev/vgdocumentum" to collect data
Activated volume group.
Volume group "/dev/vgdocumentum" has been successfully activated.
Warning: Volume Group version 2.1 does not support bad block
relocation. The bad block relocation policy of all logical volumes
will be set to NONE.
Old Volume Group configuration for "/dev/vgdocumentum" has been saved in "/etc/lvmconf/vgversion_vgdocumentum/vgdocumentum_1.0.conf"
Deactivating Volume Group "/dev/vgdocumentum"
Volume group "/dev/vgdocumentum" has been successfully deactivated.
New Volume Group configuration for "/dev/vgdocumentum" has been saved in "/etc/lvmconf/vgversion_vgdocumentum/vgdocumentum_2.1.conf"
Removing the Volume Group /dev/vgdocumentum from /etc/lvmtab
Applying the configuration to all Physical Volumes from "/etc/lvmconf/vgversion_vgdocumentum/vgdocumentum_2.1.conf"
Volume Group configuration has been restored to /dev/rdisk/disk10
Creating the Volume Group of version 2.1 with minor number 0x3000.
Adding the Volume Group /dev/vgdocumentum to /etc/lvmtab_p
Original Volume Group Version was 1.0
New Volume Group Version is 2.1
Volume Group version has been successfully changed to 2.1
if we run the lvmadm -l, we can check the upgrade:
unix:/root# lvmadm -l
--- Version 1.0 volume groups ---
VG Name /dev/vg00
PV Name /dev/disk/disk9_p2
VG Name /dev/vgasm
PV Name /dev/dsk/c4t0d0
/dev/dsk/c6t0d0
/dev/disk/disk7
VG Name /dev/vgapli
PV Name /dev/disk/disk8
--- Version 2.1 volume groups ---
VG Name /dev/vgdocumentum
PV Name /dev/disk/disk10
Now we can active the VG and the FS and we are ready to go.
The problem comes, when suddenly someone tells you, that they need to import the VG on a 11.23 server, if we have kept our VG backup Files and scripts safe we are OK.
So here we go, first check we have our backup files:
unix:/root# cd /etc/lvmconf/vgversion_vgdocumentum
unix:/etc/lvmconf/vgversion_vgdocumentum# ls
mapfile_vgdocumentum_1.0 vgdocumentum_1.0.conf vgdocumentum_disks
mapfile_vgdocumentum_2.x vgdocumentum_2.1.conf vgversion_vgdocumentum_restore
Ok we have our files, and the restore script, we have to deactive the VG and run the script:
unix# vgchange -a n /dev/vgdocumentum
Volume group "/dev/vgdocumentum" has been successfully changed.
unix:/root# cd /etc/lvmconf/vgversion_vgdocumentum/
unix:/etc/lvmconf/vgversion_vgdocumentum# ./vgversion_vgdocumentum_restore vgdocumentum_1.0.conf
vgcfgrestore: Volume group "/dev/vgdocumentum" does not exist in the "/etc/lvmtab" file.
Volume Group configuration has been restored to /dev/rdisk/disk10
The Volume Group already exists in lvmtab/lvmtab_p
Exporting the Volume group
vgexport: Volume group "/dev/vgdocumentum" has been successfully removed.
vgimport: Volume group "/dev/vgdocumentum" has been successfully created.
Warning: A backup of this volume group may not exist on this machine.
Please remember to take a backup using the vgcfgbackup command after activating the volume group.
Completed restore of VG /dev/vgdocumentum
unix# vgchange -a y /dev/vgdocumentum
Activated volume group.
Volume group "/dev/vgdocumentum" has been successfully changed.
unix# vgcfgbackup /dev/vgdocumentum
Volume Group configuration for /dev/vgdocumentum has been saved in /etc/lvmconf/vgdocumentum.conf
unix:/# lvmadm -l
--- Version 1.0 volume groups ---
VG Name /dev/vg00
PV Name /dev/disk/disk9_p2
VG Name /dev/vgasm
PV Name /dev/dsk/c4t0d0
/dev/dsk/c6t0d0
/dev/disk/disk7
VG Name /dev/vgapli
PV Name /dev/disk/disk8
VG Name /dev/vgdocumentum
PV Name /dev/disk/disk10
We are back to lvm 1.0 and now we are able to export/import this VG on any 11i server with no problems.
I will update shortly this post, with some info on how to restore to 1.0 if the vgs have been modifies since the vgversion backup has been taken.