[Ma-linux] cloning logical volumes
przemek at nist.gov
Mon Oct 5 17:35:38 EDT 2009
Suppose that we have a Linux box configured with LVMs
/dev/sdd1 * 1 13 104391 83 Linux
/dev/sdd2 14 30394 244035382+ 8e Linux LVM
where sdd2 contains the root filesystem in a logical volue, and sdd1 is
mounted on /boot.
Suppose that bad sectors start showing up, but the disk is still
readable. We want to make a copy the data onto a good disk, and throw
away the bad one. What is the recommended sequence of LVM operations? Of
course it's wrong to just dd to the new drive, because physical volume
IDS will be the same and the system will get confused between them.
I know that one can filter out the new drive in /etc/lvm/lvm.conf, but
even then we'd be dd-ing a live system, so the filesystem might be
captured incorrectly. The correct way seems to be somehow snapshot the
old drive onto the new drive using LVM, but in a way that creates
different PV UUIDs on the cloned volume.
More information about the Ma-linux