LVM migration

Q I want to setup an LVM on a server that contains two USB disks. This LVM will contain 1.5TB across the two disks and once the LVM is full, I want to migrate the disks to a different server and retrieve their content. How complex is this?

A This is a pretty straightforward task, provided you attend to a couple of details before you start copying data. When you create the partitions that will form the physical volumes, make sure you set the partition types to Linux LVM (8E). You can do this in fdisk, cfdisk (our preference for manipulating partitions) or one of the graphical partition manipulation programs such as GParted or QtParted. Secondly, when you create the volume group, give it a unique name. Don't be tempted to use a standard default such as VolGroup00, because LVM cannot handle two volume groups with the same name. If you transferred these disks to a machine with an existing volume group of the same name, only one of the volume groups would show up at most, probably neither.

We usually relate the volume group name to the hostname of the computer running it, so there's no chance of a clash when using it on a different computer. Provided you take these precautions when setting up, the logical volumes should be recognised by the new computer. If that computer already uses LVM, connecting up the discs and booting it up should be all that is needed, because the new volumes will be detected when the existing LVM is initialised. If the target computer is not already using LVM, or you plug in the USB drives without rebooting, make it recognise them with:

vgchange -a y

when running as root. Provided you have your distro's LVM package installed, your logical volumes should now appear in /dev/volumegroupname/ for you to mount.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar