Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.


  Search this Thread
Old 08-28-2013, 06:41 PM   #16
Registered: Sep 2012
Distribution: RHEL5/6, CentOS5/6
Posts: 216

Rep: Reputation: 38

There are some possibilities you can use to make use of your extra space.
A common approach is to add another partition using fdisk and add this to your volume group using vgextent followed by lvresize -r .
I usually use a different approach deleting the partition first and creating a new with the final size. Depending on your disk setup this saves you at leat a new partition ID.

All the following will be done on the domU.
Make sure you have a backup of all your data!!!

1)Extending the partition /dev/hda2:
fdisk -u /dev/hda

p # shows partition table

d # delete partition

2 # delete partition 2

n # create new partition

p # create new primary partition

2 # create new primary partition 2

<2x enter> # accept default values

t # change partition type

2 # change type for partition 2

8e # change partition type to Linux LVM

w # write partition table and exit

now your dumU will reboot.
When it's back, log in and check for obvious issues. If everything looks ok we can move on:

2)Extending the volume group VolGroup00 (to make the volume group detect the added space)
pvresize /dev/hda2
The 2 vgdisplay commands should show the old size and new size difference

3)Extending the LVM partition and file system
now we are using the -r switch (I understood this is supported in your CentOS 5.8? if not, you have to use resize2fs later as discussed a few posts above.)
df -h
lvextend -r -l +100%FREE /dev/VolGroup00/LogVol00
df -h
The df commands should show the free space before and after the resize.

When you run this procedure I'd recommend you save the output of your commands in a log. Especially the fdisk values might be a bit tricky.
Depending on your system you might want to run fdisk with the -u option anyway.

Note:I've written this procedure without trying it from top of my head. There is no warranty I haven't missed something.
Make sure you have a BACKUP

some more notes:
While using fdisk you could add a sanity check:
Before deleting the partition use "p" command to show partition details and note down the value for hda2's start sector.
Before writing the new partition table use "p" command and compare the hda2 start sector with your noted value. It should be (and usually is) the same. If not you have to use fdisk expert mode "x":
fdisk -u /dev/hda

x # expert mode

b # move partition start

2 # move start of partition 2

<note value> # set partition start

w # write changes and exit
Let us know how it went.
If you run into any trouble, please post your complete commands with output causing it.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with su when in Xen DomU [Debian] cvillelk Linux - Virtualization and Cloud 1 11-11-2012 03:12 PM
Windows DomU stuck at boot when DomU shifted vzxen Linux - Virtualization and Cloud 1 11-21-2010 10:58 PM
MySQL ibdata1 growing and growing and growing and... jnojr Linux - Software 1 07-20-2009 08:11 PM
filesystem sizes urgent somsahi Linux - Hardware 9 09-05-2006 04:35 PM
urgent: filesystem is read only buehler Linux - General 1 03-20-2005 03:50 PM > Forums > Linux Forums > Linux - Virtualization and Cloud

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

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