I have CentOS 5.5 running in a VM on XenServer. I've shutdown the VM, changed the hard drive size from 24GB to 30GB and rebooted it. The root partition (/dev/xvda1) is still showing the same size it was before.

How can I extend this partition?

link|improve this question

67% accept rate
feedback

1 Answer

up vote 2 down vote accepted

You need to do two things:

1) resize the /dev/xvda1 with the partition editor of your choice and extend the partition. In fdisk this happens with deleting the partition and re-creating it with the exactly same starting block and with the new, bigger ending block. Then save changes and possibly reboot so the new partition layout gets activated.

2) resize the underlying filesystem; for example, an ext3 filesystem (which I suspect you have due the CentOS) would be resized with resize2fs /dev/xvda1.

Be sure to have backups of your virtual machine if you have anything important there!

link|improve this answer
Thanks, can you suggest any partition editors please? – Reado Aug 19 '10 at 11:28
Most of the time I just use fdisk, with an exception with >2TB partitions which fdisk is (or at least was) unable to handle. For those I use cfdisk, which might be more intuitive for you, too. If you want to use something graphical, gparted is nice. – Janne Pikkarainen Aug 19 '10 at 11:37
OK, thanks very much. – Reado Aug 19 '10 at 13:54
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.