Extend the size of ext3 partition online in a virtual machine

I just configured a virtual machine with Redhat Entrprise Linux 5.5 as a guest operating system. The / partition of this machine was assigned a virtual disk of size 60GB. I installed all the required software and later came to know that 60GB was not sufficient so needed to extend this partition to 100GB.

Current mounted partition is as below.

#df -h

 

# fdisk -l

 

I edited the virtual hard disk size from Vmware vsphere client to 100GB. Then I rebooted the virtual machine.

Disk status after a reboot is as shown below.

# df -h

 

# fdisk -l

 

The df command displays the mounted filesystem which is ditto to that before increasing the size to 100GB. However, fdisk displays the current partition table with disk size equal to 107.3GB as shown above.

Now, I am going to re-partition the partition /dev/sda3 using fdisk so that the partition table is altered with the changes in the disk size.

 

 

Ignore any error messages as above and restart the virtual machine.

After the VM is up, resize the file system.

# resize2fs /dev/sda3

# reboot

Once the virtual machine is up you can see the extended partition /dev/sda3 as below. Please note that the size of this partition is 100GB now.

# df -h

 

5 thoughts on “Extend the size of ext3 partition online in a virtual machine”

  1. Now, I am going to re-partition the partition /dev/sda3 using fdisk so that the partition table is altered with the changes in the disk size.

  2. Now, I am going to re-partition the partition /dev/sda3 using fdisk so that the partition table is altered with the changes in the disk size.

    How did you do that? What command did you use?

  3. He used fdisk first to delete the /dev/sda3 partition.
    You do that by entering d at the : prompt of fidisk.
    Then is recreated the /dev/sda3 partition by entering n at the : fdisk prompt.
    Try it.

Leave a Reply

Your email address will not be published. Required fields are marked *


*