There can be times when you need to increase the size of the VirtualBox VDI Image.
Changing the size of the image doesn’t automatically extends the primary partition. This is a two step process:
Note: It’s advisable to take a backup of the existing image first.
Step 1: Extending the Image Size
This can be done using the VBoxManage
utility which is shipped with VirtualBox installation. In my case, my VDI was 20GB in size and I wanted to expand it to 30GB
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd "C:\Users\arpit\VirtualBox VMs\Ubuntu\Ubuntu.vdi" --resize 30720
Step 2: Extending Primary partition in Ubuntu
You can use gparted
to extend the primary partition in Ubuntu.
Download Gparted for Ubuntu : Download Link
Alternatively: You can install gparted in Ubuntu using a package manager.
In Gparted, you will be able to see the unallocated space, select that and create a new partition
You will need to mount it in fstab. Update /etc/fstab
and run mount -a
to reload the fstab entries.
My fstab entry looks like this:
# New Partition UUID=907f3b69-e891-4a3c-99c1-f0aa2838e3b3 /apps ext4 errors=remount-ro 0 2