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.
|
|
||||
|
|
|
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 ( 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 |
|||||||||||||
|
pvmove can move data between physical volumes: LVM Administrator's Guide |
|||||||||
|
|
As of the LVM in Debian stretch (9.0), namely 2.02.168-2, it's
possible to do a copy of a logical volume across volume groups using a
combination of Alternatively, you can use A complete self-contained example session using loop devices and
Summary: we create volume group Create files.
Set up loop devices on files.
Create physical volumes on loop devices (initialize loop devices for use by LVM).
Create volume groups
Create logical volumes
Create ext4 filesystems on
Optionally, write something on
Run merge command in test mode. This merges
And then for real.
Then create a RAID 1 mirror pair from
Then split the mirror. The new LV is now
Make
Then (testing mode)
For real
Resulting output:
NOTES: 1) Most of these commands will need to be run as root. 2) If there is any duplication of the names of the logical volumes in
the two volume groups, 3) On merge:
And on split:
|
|||
|
|