LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   URGENT: Trouble growing a filesystem on a domu (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/urgent-trouble-growing-a-filesystem-on-a-domu-4175474906/)

dt64 08-28-2013 05:41 PM

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:
Code:

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

reboot

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)
Code:

vgdisplay
pvresize /dev/hda2
vgdisplay

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

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":
Code:

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.


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