Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to move a logical volume from one volume group to another in whole?

It is possible to create a (more or less) matching lv and copy the data over, but is there any way to do this with LVM tools alone?

If not, is there a theoretical reason or a technical limitation (extent sizes)?

share|improve this question
add comment

1 Answer

A volume group consists of whole physical volumes. A physical volume consists of many extents (an extent is typically 4MB); each extent may belong to a different volume group. To transfer a logical volume to a different group, you cannot simply transfer extents, because that might split the physical volume between the source VG and the target VG.

What you can do is transfer one or more PVs from the source VG to the target VG, with the vgsplit command. You can specify which PVs you want to transfer, or which LV (but only one at a time). If you specify an LV, it and the other LVs in the source VG must be on separate PVs. The destination VG will be created if no VG exists with the specified name.

vgsplit -n source_group/volume_to_copy source_group target_group
vgsplit source_group target_group /dev/sdy99 /dev/sdz99

You may need to use pvmove first to arrange for the logical volumes you want to move to be on separate PVs.

If you meant to retain the physical boundaries of the VG and move the data, there's no built-in tool, but you could make a mirror then remove the original.

share|improve this answer
    
Looks like the target_group can be a pre-existing one? –  XTL Mar 25 '12 at 13:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.