With all this new technology, simple tasks like moving disks from one machine to another can get a bit tricky. Before LVM users only had to put the disk into the new machine and mount the filesystems. With LVM there is a bit more to it. The LVM structures are saved both on the disks and in the /etc/lvmconf directory so the only thing that has to be done to move a disk or a set of disks that contain a Volume Group is to make sure the machine that the VG belonged to will not miss it. That is accomplished with the vgexport
command. vgexport
simply removes the structures for the VG from /etc/lvmconf, but does not change anything on the disks. Once the disks are in the new machine (they don't have to have the same ID's) the only thing that has to be done is to update /etc/lvmconf. Thats done with vgimport
.
Example:
On machine #1:
On machine #2:
vgchange -a n vg01 vgexport vg01
vgimport vg01 /dev/sda1 /dev/sdb1 vgchange -a y vg01
Notice that you don't have to use the same name for the Volume Group. If the vgimport command did not save a configuration backup use vgcfgbackup
to do it.
FIXME: write about more neat stuff