[linux-lvm] Copying LVM from one system to another

Dieter Stüken stueken at conterra.de
Tue Jul 11 19:12:38 UTC 2006


Shaun Mccullagh wrote:
> Thanks very much, but the problem is I want be able to restore my LVM filesystems from a backup. 
> This is why I came with the idea of booting the PC I want to restore from a USB stick. 
> The idea is the stick has a copy of the backup client. The LVM filesystems are mounted under 
> /restore and I restore all the data to /restore.
> 
> How do I tell LVM the data has moved? I've experimented using this method but I noticed devmapper 
> complains when I boot the PC from the newly restored data.

Do you have any concrete error message, which give a hint about what goes wrong?

If you mount a file system, the mount command first looks into /etc/fstab to find
the device to mount. So you may configure your mount points by editing /etc/fstab.

This is very different with LVM! There is no such configuration that determines your
LVM layout. Instead all data describing the layout of your LVM is saved on the LVM
disk(s) them self! When LVM starts up, it scans all disks to find for LVM informations.
If all this configurations are consistent (if you have several LVM disk), the VGs and
LVs are registered by name, regardless on which device they are found. 
LVM then writes a protocol of all it found to /etc/lvm/backup. 
Changing the configuration is not as easy as editing some config file, 
as there is no such thing! Instead it is not necessary at all.

In your case, I would suggest to create an independent volume group on the other
disk with a different VG-name. The LVs may have the same names on both VGs.
If you put them into different hosts, you may synchronize/backup them via network.
Else you may put both VGs into the same hosts without problems, mounting the LVs manually
and copy the data directly.

Don't worry about any config-files to save. You may connect any LVM disk to any IDE
port and it should be recognized automatically.

If you move an VG from one host to an other, you should do an "vgexport" first.
I don't know if this is still necessary with LVM2. I accidentally moved VGs back
and forth even without using lvexport and did not found a problem.

Dieter.




More information about the linux-lvm mailing list