Increasing a Linux partition once VM size increased in vSphere

capacityubuntu-12.04virtual-machinesvmware-vcenter

I have a Ubuntu 12.04 VM running on VMWares ESXi 5.1.

The server (VM) itself has run out of space, the results of df -h are as follows:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        19G   17G  1.2G  94% /
udev            490M  4.0K  490M   1% /dev
tmpfs           200M  232K  199M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            498M     0  498M   0% /run/shm

The original VM HDD size was just under 19GB which is I have now increased to 100GB within the vCenter GUI:

vCenter GIU

Is there a simple way of doing this? The VM doesn't seem to acknowledge the increase at all.

Best Answer

I guess you have one big partition and all your data are on this partition this is sda1.

If this assumption is false do not proceed! (Tell me your setup: fdisk -l and I will update this answer accordingly.)

So you boot some live CD. Ubuntu LiveCD would be fine.

  1. It is always a safe bet to make backups just in case. (You can make a snapshot with vmware which you later delete if everything is fine.)
  2. So you boot some live CD. Ubuntu LiveCD would be fine.
  3. Open a terminal/shell or switch to console. If you are not root sudo bash will get you a root shell.
  4. fdisk /dev/sda
    1. Type d then 1 this will delete you partition from the partition table, but it won't touch your data.
    2. Type n then choosing the defaults is fine.
    3. Type p to see how it looks. We recreated your partition with a bigger size.
    4. Type w to write changes to disk. q exits you back to shell.
  5. resize2fs /dev/sda1 will increase the size of the filesystem.
  6. You can reboot.
Related Topic