It didn’t take me long to find out that my Ubuntu system in the VirtualBox has an inconvenient issue. It ran out of disk space! The original plan is to use it for light experiment, so I only allocated 6GB of disk space for the Ubuntu system. But since I liked it and experimented with it a little bit more, it is currently 94% utilized.

Fortunately, the native virtual disk image (VDI) file format allows you to dynamically change its size. To do that we will need to use the VirtualBox management tool “VBoxManage” to handle it. You can find it in the VirtualBox installation directory, for my case it is in “c:\Program Files\Oracle\VirtualBox”.

1. Check the Stoge file

c:\Program Files\Oracle\VirtualBox>VBoxManage.exe list hdds
UUID:        0046cf2f-8a6a-4452-911f-357133196f18
Parent UUID: base
Format:      VDI
Location:    C:\Users\tps\VirtualBox VMs\ubuntu\ubuntu.vdi
State:       created
Type:        normal
Usage:       ubuntu (UUID: fda18379-9b84-44a7-94eb-cb66381a4d8a)

2. Resize the VDI file

I decided to increase the disk space to 20GB.

c:\Program Files\Oracle\VirtualBox>VBoxManage.exe modifyhd "c:\Users\tps\Virt
ualBox VMs\ubuntu\ubuntu.vdi" --resize 20480

3. Create a new partition with the newly allocated disk space

After changing the disk space with VBoxManage, the newly added disk space is shown up in the virtual system as unallocated. We need to create a new partition to use it in the virtual system. I am using a free tool called Gparted for this purpose.

3.1. Mount the Gparted image

After you download the ISO image of the Gparted, mount it to the CD.


3.2. Boot into the Gparted System

When booting from the Gparted image, you need to press a whole bunch of enter kay. Then you will see the unallocated disk space in the following window.


3.3. Create a new partition.


201306300002 201306300003

4. Use the new partition in the Ubuntu system

After creating the partition, reboot with hard disk, check the devices in the system

sudo blkid

You will be able to see the new partition in the list.

I wanted to mount the /dev/sda3 as my /data directory. So I modified the fstab file as following.

sudo gvim /etc/fstab


Reboot, and you can see the new partition is mounted.

df -k

Well done.


How to Add Extra Disk Space to Ubuntu in VirtualBox
Tagged on:         

Please tell us what's in your mind ...

%d bloggers like this: