[linux-lvm] combining two vg's into one

Ken Fuchs kfuchs at winternet.com
Wed Jan 28 23:38:02 UTC 2004

Chris Conn wrote:

>I've got 2 vg's on two different partitions on
>different disks, one is my root vg and the other
>has /usr, /var and /tmp filesystems. I'd like to
>keep them on separate disks but use the same vg
>if I can, but I'm unsure how to combine them.

To keep / on one disk and /usr, /var and /tmp on another
disk, one volume group per disk as described above is the
best way to do this.  There is no advantage to combining
the two volume groups together given that one wants to
keep logical volumes exclusively on one disk or the other.

Combining the two volume groups into one volume group
would allow logical volumes to span the two disks and
lvm striping, but that is contrary to the desire to keep
each logical volume exclusively on a particular disk.

>Do I have to move the lv's on disk2 out of their vg
>or can I just expand the vg on disk1 to include
>them? The filesystems are all ReiserFS, system
>is Slackware Linux 9.1.

Logical volumes can't be moved between volume groups.

If the physical extents of two volume groups are the
same and the limits of the destination group are not
exceeded, the two volume groups can be merged using
vgmerge(8).  Go to step 9 below.

To join two volume groups with unequal logical extents:

1) Back up all logical volumes.
2) Remove all logical volumes in one volume group,
   preferably the volume group NOT containing /,
   using lvremove(8).
3) Remove all physical volumes from the volume
   group to be removed using vgreduce(8).
4) Finally remove that volume group using vgremove(8).
5) Add all physical volumes that were in the removed
   volume group into the remaining volume group using
6) Within the remaining volume group, create all logical
   volumes removed in step 2 using lvcreate(8)
7) Create the desired filesystems for each logical
   volume created in step 6.
8) Restore from backup each filesystem created in
   step 7.
9) Modify /etc/fstab and any other configuration files
   to reflect the volume group name change in the
   "moved" (removed/recreated) volumes.


Ken Fuchs <kfuchs at winternet.com>

More information about the linux-lvm mailing list