Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm rearranging a bunch of disks on my server at home and I find myself in the position of wanting to move a bunch of LVM logical volumes to another volume group. Is there a simple way to do this? I saw mention of a cplv command but this seems to be either old or not something that was ever available for Linux.

share|improve this question
up vote 17 down vote accepted

If you can arrange for the logical volume to be on a separate subset of physical volumes from the rest of the source volume group (lvconvert sourcevg/sourcelv /dev/pv1 ... may help), you can use vgsplit to split off the lv into a new vg and vgmerge to merge the new vg into the target vg.

Although LVM has a mirroring feature, you can't (sanely) use it to make a copy between volume groups, because both legs of the mirror must live on the same vg and the association can't be broken.

You can copy an LVM volume to another the way you'd copy any volume to another: create a target lv of the appropriate size, then copy the contents with dd if=/dev/sourcevg/sourcelv of=/dev/targetvg/targetlv bs=4M. If the source volume is active, you can leverage LVM to mkae a consistent copy: first take a snapshot of the source lv with lvcreate -s, then copy the snapshot.

share|improve this answer
Brilliant Gilles....vgsplit / vgmerge will probably be just fine: I can use pvmove after that to move the physical extents to the new disk and then remove the old volume from the VG. – jkp Dec 2 '10 at 9:36
Shame, this didn't work for me in the end due to differing extent sizes. If thats not an issue for you though I suggest this method would be easiest. – jkp Dec 2 '10 at 14:37
After dd (if you don't hurry to throw off old volumes), don't forget to change UUID of new filesystems: tune2fs -U random /dev/targetvg/targetlv – midenok Oct 20 '14 at 15:55
pvmove -n lvol1 /dev/sdb1 /dev/sdc1

pvmove can move data between physical volumes: LVM Administrator's Guide

share|improve this answer
But not between volume groups. – MattBianco Sep 19 '13 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .