public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Need a clue about merging logical volumes/groups with lvm2
@ 2012-07-21 21:11 walt
  2012-07-21 21:42 ` Alex Schuster
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: walt @ 2012-07-21 21:11 UTC (permalink / raw
  To: gentoo-user

I know there are a few lvm2 experts lurking here :)

I have a 500gig disk that is split roughly in half between two volume
groups, each containing four physical volumes, and each vg is formatted
into an ext4 filesystem of roughly 250GB.

What I plan to do is merge the two volume groups into one, containing
one big ext4 filesystem, which will contain all of the files currently
on the disk.

Can this be done without copying one of the existing ext4 filesystems
to a separate drive first, and then copying it back after extending
the remaining vg/filesystem? (One filesystem has 24GB free and the
other has 25GB free.)

I'm expecting a "no" but I'd like to be wrong :)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Need a clue about merging logical volumes/groups with lvm2
  2012-07-21 21:11 [gentoo-user] Need a clue about merging logical volumes/groups with lvm2 walt
@ 2012-07-21 21:42 ` Alex Schuster
  2012-07-22  8:46 ` Neil Bothwick
  2012-07-22 15:46 ` [gentoo-user] " Alan McKinnon
  2 siblings, 0 replies; 7+ messages in thread
From: Alex Schuster @ 2012-07-21 21:42 UTC (permalink / raw
  To: gentoo-user

walt writes:

> I know there are a few lvm2 experts lurking here :)
> 
> I have a 500gig disk that is split roughly in half between two volume
> groups, each containing four physical volumes, and each vg is formatted
> into an ext4 filesystem of roughly 250GB.
> 
> What I plan to do is merge the two volume groups into one, containing
> one big ext4 filesystem, which will contain all of the files currently
> on the disk.
> 
> Can this be done without copying one of the existing ext4 filesystems
> to a separate drive first, and then copying it back after extending
> the remaining vg/filesystem? (One filesystem has 24GB free and the
> other has 25GB free.)
> 
> I'm expecting a "no" but I'd like to be wrong :)

I think you are right.

But if you had more free space, it might be possible. So your physical
volumes are about 63 G each. If you free that much space on one
filesystem, reduce the file system, then reduce the LV, you can use
pvmove to move stuff from one PV you want to empty to the others. When
done, you can remove the now empty PV from the VG with vgreduce. Then use
vgextend to add the PV to the other VG. Extend the LV of that VG and
enlarge the file system, copy stuff from the other FS over until you can
free another PV. And so on.

But copying all stuff of one VG to another location would be much easier.
And less error-prone.

	Wonko


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Need a clue about merging logical volumes/groups with lvm2
  2012-07-21 21:11 [gentoo-user] Need a clue about merging logical volumes/groups with lvm2 walt
  2012-07-21 21:42 ` Alex Schuster
@ 2012-07-22  8:46 ` Neil Bothwick
  2012-07-22 10:53   ` [gentoo-user] " walt
  2012-07-22 15:46 ` [gentoo-user] " Alan McKinnon
  2 siblings, 1 reply; 7+ messages in thread
From: Neil Bothwick @ 2012-07-22  8:46 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]

On Sat, 21 Jul 2012 14:11:03 -0700, walt wrote:

> I have a 500gig disk that is split roughly in half between two volume
> groups, each containing four physical volumes, and each vg is formatted
> into an ext4 filesystem of roughly 250GB.

This doesn't make sense, VGs don't have filesystems, they contain LVs
and they have the filesystems.

> What I plan to do is merge the two volume groups into one, containing
> one big ext4 filesystem, which will contain all of the files currently
> on the disk.

> 
> Can this be done without copying one of the existing ext4 filesystems
> to a separate drive first, and then copying it back after extending
> the remaining vg/filesystem? (One filesystem has 24GB free and the
> other has 25GB free.)

It can, by moving data from an LV on one VG to an LV on the other, then
reducing one LV and VG and increasing the other. But with so little free
space, it would take forever, and you'd still end up with a 90%+ full
filesytem.

If you have a spare drive, I'd add a partition on that to the VG you want
to keep, increase the LV size and move everything over. Then remove the
VGs from the second disk, add it to the first VG and use pvmove to move
everything off the spare disk before removing it from the VG. You can
continue to use the system while this runs, so this gives the least
downtime with minimal hassle.


-- 
Neil Bothwick

Never underestimate the bandwidth of a station wagon full of tapes!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-user] Re: Need a clue about merging logical volumes/groups with lvm2
  2012-07-22  8:46 ` Neil Bothwick
@ 2012-07-22 10:53   ` walt
  2012-07-22 14:28     ` Neil Bothwick
  0 siblings, 1 reply; 7+ messages in thread
From: walt @ 2012-07-22 10:53 UTC (permalink / raw
  To: gentoo-user

On 07/22/2012 01:46 AM, Neil Bothwick wrote:

> If you have a spare drive, I'd add a partition on that to the VG you want
> to keep,

Aha!  That's exactly the kind of outside-the-box hint I needed, thanks.
Now that I understand the concept, the rest should be "easy".  Just like
everything else about computers ;)

> increase the LV size and move everything over. Then remove the
> VGs from the second disk, add it to the first VG and use pvmove to move
> everything off the spare disk before removing it from the VG. You can
> continue to use the system while this runs, so this gives the least
> downtime with minimal hassle.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Re: Need a clue about merging logical volumes/groups with lvm2
  2012-07-22 10:53   ` [gentoo-user] " walt
@ 2012-07-22 14:28     ` Neil Bothwick
  2012-07-22 23:19       ` walt
  0 siblings, 1 reply; 7+ messages in thread
From: Neil Bothwick @ 2012-07-22 14:28 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

On Sun, 22 Jul 2012 03:53:37 -0700, walt wrote:

> > If you have a spare drive, I'd add a partition on that to the VG you
> > want to keep,  
> 
> Aha!  That's exactly the kind of outside-the-box hint I needed,

So it's an external drive then? ;-)


-- 
Neil Bothwick

"There are some ideas so idiotic that only an intellectual could believe
them" George Orwell

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] Need a clue about merging logical volumes/groups with lvm2
  2012-07-21 21:11 [gentoo-user] Need a clue about merging logical volumes/groups with lvm2 walt
  2012-07-21 21:42 ` Alex Schuster
  2012-07-22  8:46 ` Neil Bothwick
@ 2012-07-22 15:46 ` Alan McKinnon
  2 siblings, 0 replies; 7+ messages in thread
From: Alan McKinnon @ 2012-07-22 15:46 UTC (permalink / raw
  To: gentoo-user; +Cc: w41ter

On Sat, 21 Jul 2012 14:11:03 -0700
walt <w41ter@gmail.com> wrote:

> I know there are a few lvm2 experts lurking here :)
> 
> I have a 500gig disk that is split roughly in half between two volume
> groups, each containing four physical volumes, and each vg is
> formatted into an ext4 filesystem of roughly 250GB.
> 
> What I plan to do is merge the two volume groups into one, containing
> one big ext4 filesystem, which will contain all of the files currently
> on the disk.
> 
> Can this be done without copying one of the existing ext4 filesystems
> to a separate drive first, and then copying it back after extending
> the remaining vg/filesystem? (One filesystem has 24GB free and the
> other has 25GB free.)
> 
> I'm expecting a "no" but I'd like to be wrong :)
> 
> 

For the most part, the answer is no.

But to be totally accurate, it can be done - you just have to shuffle
partitions and contents around on the disk a lot in this fashion:

Move something a bit further towards the end,
Extend the thing in front of it to use the now-free space.

But be warned, it's a complete PITA and a lot like playing the "15
pieces" game with your disk volumes.

You have about 10% free space on both vgs, so the odds you can move
things around successfully are not good. Get yourself a 500G portable
drive to help with the migration.


-- 
Alan McKinnon
alan.mckinnon@gmail.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-user] Re: Need a clue about merging logical volumes/groups with lvm2
  2012-07-22 14:28     ` Neil Bothwick
@ 2012-07-22 23:19       ` walt
  0 siblings, 0 replies; 7+ messages in thread
From: walt @ 2012-07-22 23:19 UTC (permalink / raw
  To: gentoo-user

On 07/22/2012 07:28 AM, Neil Bothwick wrote:
> On Sun, 22 Jul 2012 03:53:37 -0700, walt wrote:
> 
>>> If you have a spare drive, I'd add a partition on that to the VG you
>>> want to keep,  
>>
>> Aha!  That's exactly the kind of outside-the-box hint I needed,
> 
> So it's an external drive then? ;-)

<groans>

I know there's another Bothwick tagline lurking somewhere above, but
I'll need another beer to identify it.  (Maybe two.)






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-22 23:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-21 21:11 [gentoo-user] Need a clue about merging logical volumes/groups with lvm2 walt
2012-07-21 21:42 ` Alex Schuster
2012-07-22  8:46 ` Neil Bothwick
2012-07-22 10:53   ` [gentoo-user] " walt
2012-07-22 14:28     ` Neil Bothwick
2012-07-22 23:19       ` walt
2012-07-22 15:46 ` [gentoo-user] " Alan McKinnon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox