How to migrate a LVM volume group to a different host

Jump to: navigation, search


This article explains how to use export a LVM volume group and import it on a different host. The vgexport and vgimport commands are used for this task. Equivalent technology is to configure shared LVM volumes on a MC/Service Guard enviroment.

Create LVM volume group mapfile in the source server[edit]

1. Create a map file of the volume group on source server.

# vgexport -p -s -m /tmp/<vgname>.mapfile /dev/<vgname>

2. Check that the map files contains the VGID at the first line and logical volumes name at the next lines.

# cat /tmp/<vgname>.mapfile


# vgexport -p -s -m /tmp/vg00.mapfile /dev/vg00
vgexport: Volume group "/dev/vg00" is still active.
vgexport: Preview of vgexport on volume group "/dev/vg00" succeeded.
# cat /tmp/vg00.mapfile
VGID 1e69dc32486a8cc1
1 lvol1
2 lvol2
3 lvol3
4 lvol4
5 lvol5
6 lvol6
7 lvol7
8 lvol8
9 test

3. Copy the mapfile to the remote server or any external storage. Create backups of the mapfile(s).

Remove LVM volume group from from the source host[edit]

1. Stop all access to the storage devices, unmount file system if required, disable the volume group and export the volume group. Alternative if the system will be decommisioned just shutdown the server.

# vgchange -a n /dev/<vgname>
# vgexport /dev/<vgname>

2. Remove the device special files of the physical volumes that will be moved to a different host.

# rmsf -H <HW Path> 

or alternative:

# rmsf -a /dev/dsk/c#t#d#

3. Remove the disk(s) or unpresent the logical units (LUN) them from the source host. This task is specific the backing storage subsystem used.

Import the LVM volume group on the target server[edit]

1. Add or present the old disk(s) (physical volumes) to the target server. This task is specific the storage or SAN platform in use..

2. Scan for new hardware and create the new special device files if not already present.

# ioscan -fnC disk
# insf -e

3. Create the LVM volume group special device file to import the volume group. Verify that mknod uses hexacimal instead of decimal numbering scheme.

# mkdir /dev/<vgname>
# mknod /dev/<vgname>/group c 64 0x##0000

4. Import the volume group using the map file. Since the map files contains the VGID, you don't need to specify the new physical volume paths because every disk on the storage subsytem will be scanned to match against the mapfile VGID. This is the prefered method. Alternative, you can especify every physical volume path to the vgimport command if those are know before hand.

# vgimport -s -m /tmp/<vgname>.map /dev/<vgname>

or alternative:

# vgimport -m /tmp/<vgname>.map /dev/<vgname> /dev/dsk/<c#t#d#> ...

On HP-UX 11i v3 (11.31) use Agile View device special files like /dev/disk/disk# instead of the legacy device special files /dev/dsk/c#t#d#.

5. Activate the volume group

# vgchange -a y /dev/<vgname>

6. Create a current LVM configuration backup file.

# vgcfgbackup /dev/<vgname>

7. Activate the volume group.

# vgchange -a y /dev/<vgname>

After completing this procedure, the volume group is imported. Update any configuration on /etc/fstab and mount the file systems as needed.