LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-21-2010, 01:22 PM   #1
Slowfamily
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Rep: Reputation: 0
Merging Logical Volume Groups


Hello,

I am very new to LVM, as well as not especially experienced at linux, and have some questions that I'm hoping are rather simple, but please let me know if I'm misunderstanding anything about how lvm works or if there's any guidance you can give me.

A few months back I set up a server running FC10 and tried creating Logical Groups during the the initial setup. We've realized that we are not using all the available space on the physical drive, and I realized that for some reason (I'm thinking this might have been the default?), we initially created two Logical Groups (VolGroup00 and VolGroup01) and it appears two Logical volumes in each (LogVol00 and LogVol01). LogVol00 in VolGroup00 is mapped to /, and the other Group was actually unused.

I figure that it would be simplest to just use all this space mapped to /, so I thought the thing to do would be to simply merge VolGroup01 to VolGroup00. I tried this:

[root@office mapper]# vgmerge VolGroup00 VolGroup01
Logical volumes in "VolGroup01" must be inactive

So after a bit of research, I tried this:

[root@office mapper]# vgchange -a n VolGroup01
Can't deactivate volume group "VolGroup01" with 1 open logical volume(s)

So apparently There's an open volume, but I don't know how to go about closing it. I removed the LogVol00 from that group, but LogVol01 won't budge.

[root@office mapper]# lvremove VolGroup01
Can't remove open logical volume "LogVol01"

So how do I go about closing this Volume? At one point, there was some output that told me LogVol01 was being used as swap space. How do I handle that?

Thanks in advance!
 
Old 10-21-2010, 02:21 PM   #2
valen_tino
Member
 
Registered: Jan 2008
Posts: 105

Rep: Reputation: 28
You cannot delete LVs when they are active make any VG changes with active LVs.

Here are high level steps of what you could do after taking a backup of your data:
1. Disable and remove swap (see here).
2. Unmount and remove LV0 and LV1 from VG1 with umount/lvremove
3. Remove VG1 with vgremove
4. Unmount LV0 and LV1 from VG0 with umount
5. Extend VG0 with any available PVs if necessary
6. Mount LV0 and LV1 on VG0 with mount
7. Create and enable swap (see here)

Note: You could also merge the VGs instead of step 3 above. Ofcourse you will have to unmount volumes in VG0 prior to doing that.

Basically you are left with VG0 which contains LV0 and LV1 .......

....or you could simply backup your data, rebuild the server to your liking and restore the data!

HTH

Last edited by valen_tino; 10-21-2010 at 02:29 PM.
 
Old 11-01-2010, 04:43 PM   #3
Slowfamily
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Awesome! Thanks valen_tino! The step of disabling and removing the swap was what I was missing. I'm really surprised I didn't run in to that step earlier while I was searching around.

I'm not certain what I should be doing with the swap on the LG00 that I have now. Since I've increased the size of that group, do I need to adjust the swap in some way? Or can I just keep it however it was set?

Thanks again!
 
Old 11-02-2010, 05:25 AM   #4
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
Hi

Glad you solved your problem.

A word of advice on LVM is that its power lies in the ability to easily scale up/down your system without having to backup/re-install. Having all your volumes in one volume group is not a bad idea (especially if you only have a single disk); however you should consider separating your filesystems over different logical volumes.

So for example / could have its own LV and you can give some of your applications a separate volume. The advantage of this is for example, if you have an application that is rapidly growing in size for some reason, its separated from the / filesystem; and thus won't impact your base install if it grows uncontrollably.

The above is not a hard and fast rule; but just what I've found to be useful in my experience
 
Old 11-03-2010, 06:40 PM   #5
Slowfamily
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks for the input, Yas.

This system was carried over from an older version of Fedora that was not set up with LVM, so I'm just trying to stick to the filesystem structure as it was. I do like the concept of LVM, however, and like the fact that we have the capabilities it offers moving forward.

~SloAF
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Logical Groups out of a Physical Volume Hi_This_is_Dev Linux - Server 2 04-26-2010 09:31 PM
Extending logical volume LogVol01 Insufficient allocatable logical exte swap space umeshsharma Linux - Newbie 4 06-22-2009 01:26 PM
Logical Volume recovery plythgam Linux - Software 2 03-27-2006 07:44 PM
resizing a logical volume nicentral AIX 2 06-11-2005 05:03 PM
Logical Volume Groups concoran Linux - General 3 06-03-2001 07:29 AM


All times are GMT -5. The time now is 05:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration