LVM -> dd -> LVM?

Solution 1:

So I think what you would want to do would be one of the following:

  1. Mount the dd image over loopback.
  2. Rewrite a real disk with the dd image and mount it.

Then, you'll want to "redetect" the LVM config by running:

pvscan
vgscan -ay
lvscan

This is what I've done with EBS clones but not dd clones; but hopefully it also works, it's the same theory.

Solution 2:

First of all you should create an LVM that is at least the same size of the original one. Then you can do something like:

local# dd if=/dev/vglocal/lvm-old | ssh remote dd of=/dev/vgremote/lvm-new

And that should do it. If you already have a file with the original lvm on the remote server, then something very similar can be done:

remote# dd if=/path/to/img of=/dev/vgremote/lvm-new

You could also add the option bs to increment the blocksize used by dd, to speed up the process:

# dd if=... of=... bs=131072