Gentoo Archives: gentoo-user

From: Alex Schuster <wonko@×××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Need a clue about merging logical volumes/groups with lvm2
Date: Sat, 21 Jul 2012 21:44:23
Message-Id: 20120721234233.18e7c59b@weird.wonkology.org
In Reply to: [gentoo-user] Need a clue about merging logical volumes/groups with lvm2 by walt
1 walt writes:
2
3 > I know there are a few lvm2 experts lurking here :)
4 >
5 > I have a 500gig disk that is split roughly in half between two volume
6 > groups, each containing four physical volumes, and each vg is formatted
7 > into an ext4 filesystem of roughly 250GB.
8 >
9 > What I plan to do is merge the two volume groups into one, containing
10 > one big ext4 filesystem, which will contain all of the files currently
11 > on the disk.
12 >
13 > Can this be done without copying one of the existing ext4 filesystems
14 > to a separate drive first, and then copying it back after extending
15 > the remaining vg/filesystem? (One filesystem has 24GB free and the
16 > other has 25GB free.)
17 >
18 > I'm expecting a "no" but I'd like to be wrong :)
19
20 I think you are right.
21
22 But if you had more free space, it might be possible. So your physical
23 volumes are about 63 G each. If you free that much space on one
24 filesystem, reduce the file system, then reduce the LV, you can use
25 pvmove to move stuff from one PV you want to empty to the others. When
26 done, you can remove the now empty PV from the VG with vgreduce. Then use
27 vgextend to add the PV to the other VG. Extend the LV of that VG and
28 enlarge the file system, copy stuff from the other FS over until you can
29 free another PV. And so on.
30
31 But copying all stuff of one VG to another location would be much easier.
32 And less error-prone.
33
34 Wonko