This very good tip comes from norbert over at and the original article can be found here. I’m only keeping the info here as reference.

Three easy steps:
Enlarging the virtual drive
Enlarging the partition holding the root file system with parted
Enlarging the file system with resize2fs

Step 1: With the host computer running Windows, resizing the .vdi harddrive to 16GB is done like this:

C:\Users\Netzgewitter\VirtualBox VMs\BackTrack5>"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "BackTrack 5.vdi" --resize 16384

Step 2: Resizing the Partition

Boot the virtual machine with a live cd where you can run parted.
Turn off the swap partition:
user@bt:~$ sudo swapoff /dev/sda5

Check the partitions with parted:
(parted) unit cyl
(parted) print
(parted) rm 2
(parted) print

Recreate the swap partition at the end of the drive with the command mkpart:

(parted) mkpart extended -51 -1
(parted) mkpart logical linux-swap -51 -1
(parted) print

The new swap partition also needs to be activated:
user@bt:~$ sudo mkswap /dev/sda5

Now delete the first partition and recreate it at the exact same location. Just bigger.
Switch the displayed units to chs (cylinder/head/sector).

(parted) unit chs
(parted) print

If the second partition starts at 2037,171,54, and the geometry of the disk is 2088,255,63 then let partition 1 end at 2036,254,62, as it will be the last cylinder before partition 2. If the numbers are different, then just make sure you don’t overlap the partitions. Also make sure that the partition 1 begins the same place as before. For me it’s at 0,32,32.

(parted) rm 1
(parted) mkpart primary ext4 0,32,32 2036,254,6
(parted) print

Make the partition bootable:
(parted) toggle 1 boot
(parted) print

Modify /etc/fstab to make sure the UUID are correctly sat:

user@bt:~$ sudo blkid

Example of the /etc/fstab:
# / was on /dev/sda1 during installation
UUID=f9ae2c40-1edd-47c0-9ae7-11c4c08dcf50 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=91eaafab-b4e2-4821-90d7-2b3ef093bdcf none swap sw 0 0

Step 3: Enlarging the File System
Restart the virtual machine booting from the harddrive, and run the following command when booted:

user@bt:~$ sudo resize2fs /dev/sda1