Lately I have been working on the Mozilla Firefox 's Android Version Fennec. And Linux was the most preferable place to setup the development environment. When I had created the VirtualBox Machine last year I never thought that  disk space requirement will grow more than 10 GB. While upgrading the Android SDK itself I ran out of space and as a work around I had to delete the older version of flatforms (Android-8 to Android-12). I needed only Android-13 and above. However while building it I faced shortage of disk space again and this time I had two choices , either tweak the existing virtual disk to increase the size or re-create the machine. re-creating machine is a costly option as I had to setup everything in that machine. This is why sometimes I believe virtual disk is better than native installation. At least if you take back up of the virtual disk and it will work for life long , even if you change the hardware.

I took help of the VirtualBox forum and came to know about a solution as follows.

1.Resize the virtual disk

D:Program FilesOracleVirtualBox>VBoxManage modifyhd D:VMUbuntuUbuntu.vdi -
-resize 20480

2.Download the Gparted ISO
3.Add the ISO as Virtual DISK Boot from the it using the same machine in Virtual Box
4.Resize the primary partition which is has low space and extend it to the unallocated space
5.delete the swap and then extend the first partition and make sure to leave enough at the end to add the swap back.

Thats all.