FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 07-21-2012, 09:42 PM
Alex Schuster
 
Default Need a clue about merging logical volumes/groups with lvm2

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
 
Old 07-22-2012, 08:46 AM
Neil Bothwick
 
Default Need a clue about merging logical volumes/groups with lvm2

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!
 
Old 07-22-2012, 10:53 AM
walt
 
Default Need a clue about merging logical volumes/groups with lvm2

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.
 
Old 07-22-2012, 02:28 PM
Neil Bothwick
 
Default Need a clue about merging logical volumes/groups with lvm2

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
 
Old 07-22-2012, 03:46 PM
Alan McKinnon
 
Default Need a clue about merging logical volumes/groups with lvm2

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
 
Old 07-22-2012, 11:19 PM
walt
 
Default Need a clue about merging logical volumes/groups with lvm2

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.)
 

Thread Tools




All times are GMT. The time now is 11:41 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org