Step 1: Increase the VMDK size
Using Virtual Box
Unfortunately, Virtual Box cannot resize VMDKs, but it can resize VDI images. So, we will convert the disk to a VDI, and then increase its size.
- Shut down the VM.
Find the location of the VMDK (e.g. /Users/<user>/VirtualBox VMs/<VM Name>/)
Using VBoxManage to clone the image and resize it.
- Update VirtualBox to use the new image. This can be done using the command line, but it's easier to use the GUI. Select the VM and click the Setting button. Navigate to the storage tab, click on the old virtual disk, and then click on the small minus at the bottom to remove the drive. Then, click the little hard drive with the plus sign on the SCSI controller to add your new disk. Select choose existing disk, and then clone.vdi.
It is really easy to increase the size of a VMDK in VMWare. First, shut down the VM and open the VM Settings Panel. Click on the Hard Disk icon, and enter the new disk size.
Step 2: Increase the Partition size
Some may consider the following "dangerous". However, you already have a backup of your virtual disk if you used the VirtualBox method above. If you want to be "safer", find a LiveCD or GParted ISO, and perform the following steps with /dev/sda1 unmounted.
But, without further ado:
- Boot up your VM with the new or enlarged virtual disk.
Turn off swap
Remove the swap partitions (/dev/sda5) and the extended partition (/dev/sda2), then resize (delete and recreate) the root partition (/dev/sda1)
The changes will not be taken into effect until reboot. We also want to do fsck on reboot.
Step 3: Increase the Filesystem size
All you need to do is run the following:
You can verify your hard work with: