HP/UX LVM migration


For a customer of us we needed to migrate the complete SAN data on HP/UX 11.x machines to a new SAN. This can be done by creating a complete backup, connecting the new SAN and doing a complete restore. Not only does this take a lot of time, it also means a lot of down time. And, as you can guess, this was not an option.

Well, we had to think of something else. After giving it some thought we decided that we could solve this problem with LVM mirroring.

It goes like this:

Make sure the new SAN devices are visible

ioscan -Cdisk

Create the device files

insf -Cdisk

Find out what the current device of a volume group is

vgdisplay -v <volume group>

Give the next command sequence

pvcreate /dev/rdsk/<new SAN device>
vgextend /dev/<volume group> /dev/dsk/<new SAN device>
for f in $(vgdisplay -v <volume group> | awk '/LV Name/ { print $3 }')
do
    lvextend -m 1 ${f} /dev/dsk/<current SAN device> /dev/dsk/<new SAN device>
done

Now it’s time for some coffee and a long wait. The system mirrors all logical volumes in the volume group

After the mirroring is done

for f in $(vgdisplay -v <volume group> | awk '/LV Name/ { print $3 }')
do
    lvreduce -m 0 ${f} /dev/dsk/<current SAN device>
done

After some testing time, when the system is considered fully functional, the old SAN can be disconnected. This can leave stale devices, but that can be solved easily with a reboot.

pvreduce <volume group> /dev/dsk/<current SAN device>
Old 

See also