[linux-lvm] moving a logical volume between servers
Stuart D. Gathman
stuart at bmsi.com
Tue Dec 4 16:46:56 UTC 2007
On Tue, 4 Dec 2007, Brad Sickler wrote:
> I'm surprised I couldn't find a good answer to the question before but I
> want to move logical volumes from one computer to another.
> A little more detail... I created a bunch of xen images on logical
> volumes. I brought another computer up to split the load of all the
> virtual machines and I want to move some volumes to the new computer.
> When I created them I figured I could just dd them like a partition but
> upon attempting this and booting the transported xen machine/logical
> volume fsck showed some bad errors on the boot partition of the virtual
> machine. The later partitions seemed fine.
I do this all the time. You want to take a snapshot of the LV and copy
the snapshot. Make sure the target is the same size or bigger.
This works with journaled filesystems like ext3, xfs, reiserfs, jfs. If you do
it with ext2 or other non-journalled fs, you'll need to run fsck on the copy.
Oh, and once I reversed the src and dst :-( Now I have a co-worker check
before I press enter.
PS. It would be possible for LVM to flag PEs newly added to an LV as
"uninitialized". Attempts to read uninitialized data could result in
a read error. This would catch a lot of fat finger mistakes - if it
didn't break too much stuff in the process. Maybe just flag the entire LV
"write only" until the first write, and subsequent first reads would
return zeroes for security reasons. There should be a flag to disable
all this in case the LV is created for data recovery purposes.
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
More information about the linux-lvm