LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 06-06-2010, 11:26 PM   #1
mhouston100
Member
 
Registered: Jun 2010
Posts: 32

Rep: Reputation: 16
Partition resize for LVM


Back again so quickly!

On recomendation from the team installing the DB on our new server, all the partitions etc on our VM were created as LVM's. The setup for this is like this:

Disk 1
-> /boot
-> /swap
-> LVMpartition1
---> LVgroup1
------> lvroot
--------> /
------>lvtemp
-------->/tmp
------>lvhome
-------->/home (etc etc)

Disk 2
-> LVMpartition2
---> LVgroup2
------> lvlive
--------> /live

and a few more after this. Now as this is a VM we allowed a bit of extra space etc for the partitions to grow, however on Disk 2, the physical disk allocated by the VM ended up not being big enough. I thought this would be a simple matter of increasing the HDD size in the VM manager and growing the partition, then group, then volume, but I can find no way to do this after a few hours searching. I see that it would be possible to add another partition into the free space and add it too the group etc but I would rather avoid this as over the next few months this may need to grow a fair amount and I would hate to end up with 50+ partitions everytime space was needed.

There are plenty of instructions and info on how to grow and shrink volumes and groups if the physical space has already been allocated in the LVM partition but not after that.

As always any help is greatly appreciated.
-Matt

EDIT : Fdisk see's the space fine:

Disk /dev/sdc: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 5221 41937651 8e Linux LVM

Last edited by mhouston100; 06-06-2010 at 11:38 PM. Reason: Formatting
 
Old 06-07-2010, 09:07 AM   #2
g33ky
Member
 
Registered: Jun 2010
Location: France
Distribution: openSUSE 11.2, (B)LFS, Mepis, Linux Mint 9
Posts: 30

Rep: Reputation: 17
Hello MHouston !!

First, can you tell me which version of RHEL or Fedora (maybe) are you using ? Is it LVM1 or LVM2 ? As you said "[...]Now as this is a VM we allowed a bit of extra space etc for the partitions to grow[...]", which method did you use to add the extra space ? SAN ? adding more drives ? extending the raid ?

Thanks for your answer !

g33ky
 
Old 06-07-2010, 01:53 PM   #3
JD50
Member
 
Registered: Nov 2007
Location: Virginia
Distribution: Fedora, RHEL, CentOS
Posts: 67

Rep: Reputation: 17
I'm having trouble understanding your problem. Is the problem that your physical partition has grown, but the physical volume is still the same size? If so, have you tried pvresize?
 
Old 06-07-2010, 05:56 PM   #4
mhouston100
Member
 
Registered: Jun 2010
Posts: 32

Original Poster
Rep: Reputation: 16
Ok some details:

RHEL 5.5 drives are LVM2

The machine is a VM which is located on the SAN (Plenty of space on the SAN at the moment). The change that I made size-wise is in the VM virtual HDD settings, increased the disk size so in essence:
  • Created the drive at 40 GB
  • Created LVM Partition 40GB
  • Created LVMGroup to cover whole partition
  • Created LV to fill whole group
  • Realised its supposed to be 50GB and increased the physical HDD to 50GB (through VM)

And now im stuck, obviously I can create a new partition and add that to the LVM group but this partition is likely to grow multiple times and I would rather not end up with a bunch of partitions IF there is a way to simply grow the LVM partition that is holding the group.

I have seen plenty of way to grow the groups and volumes IF the partition was created larger in the beginning, but nothing to indicate how to do what im asking.

Thanks for the responses guys as well.
 
Old 06-07-2010, 06:43 PM   #5
JD50
Member
 
Registered: Nov 2007
Location: Virginia
Distribution: Fedora, RHEL, CentOS
Posts: 67

Rep: Reputation: 17
pvresize should do what you need.
 
Old 06-07-2010, 08:21 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,485

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
"man lvm" - have a look at the list of commands at the bottom.
Redhat have (had) good documents on LVM - also tldp.org.
 
Old 06-07-2010, 08:34 PM   #7
mhouston100
Member
 
Registered: Jun 2010
Posts: 32

Original Poster
Rep: Reputation: 16
Ok I think If have the process on what to do, i'm just waiting for the VM to clone again and getting it straight for when its complete.

From what I understand I need to :
  1. Use fdisk to resize the actual partition to fill the physical space, this seems to be done by removing the partition and re-creating it in the same space (same start point and a later end point)
  2. Use pvresize to resize the LVM partition
  3. Use lvresize to resise the logical volume(s) i want to resize
  4. fs2resize (or similar) to resize the filesystem thats to grow to the LV

Shouldnt be long for the cloning to finish and ill give it a shot!

Thanks again guys.
 
Old 06-07-2010, 09:28 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,485

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
2a. vgresize

Depending on your distro you may not have this. Spend some time with google ...
 
Old 06-07-2010, 10:41 PM   #9
JD50
Member
 
Registered: Nov 2007
Location: Virginia
Distribution: Fedora, RHEL, CentOS
Posts: 67

Rep: Reputation: 17
Quote:
Originally Posted by mhouston100 View Post
Ok I think If have the process on what to do, i'm just waiting for the VM to clone again and getting it straight for when its complete.

From what I understand I need to :
  1. Use fdisk to resize the actual partition to fill the physical space, this seems to be done by removing the partition and re-creating it in the same space (same start point and a later end point)
  2. Use pvresize to resize the LVM partition
  3. Use lvresize to resise the logical volume(s) i want to resize
  4. fs2resize (or similar) to resize the filesystem thats to grow to the LV

Shouldnt be long for the cloning to finish and ill give it a shot!

Thanks again guys.
Yep, that should work. If you run into any problems, you might need to do some of that using a rescue disk, I'm not sure if the pvresize stuff can be done live since I've never done that before. Everything else can be done live. Also, the command is resize2fs. This is the kind of stuff that turned me onto using LVM almost exclusively, I love LVM.
 
Old 06-07-2010, 11:07 PM   #10
mhouston100
Member
 
Registered: Jun 2010
Posts: 32

Original Poster
Rep: Reputation: 16
All appears to have worked fine! I'm doing a bit more testing on it now and i'll put up some instructions for anyone else looking for a similar thing
 
  


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
[Suse Enterprise Server 9] resize LVM partition noir911 Suse/Novell 0 03-28-2007 05:13 AM
LVM Resize - After logical resize, FS size does not match physical size. spectra Linux - Software 6 11-01-2006 12:28 PM
How To Resize LVM Partition sfo Linux - General 1 09-17-2006 12:39 PM
resize LVM partition bkesting Linux - General 3 06-17-2005 10:28 AM
Resize existing and add another partition with LVM donv2 Linux - Newbie 3 04-27-2005 05:23 AM


All times are GMT -5. The time now is 11:08 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration