Virtualbox: OS cannot use the new extended disk space (.vdi)

I am running Virtualbox. I increased the size of my hard disk (.vdi) from 10G to 15G. Now when I start my Mint vm, the hard disk reports as 7.5g (df) even though i extended it (fdisk -l). I am not sure what is the problem. Can anyone point me the problem?

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1     >>7.5G<< 7.1G   61M 100% /
udev            1.5G  4.0K  1.5G   1% /dev
tmpfs           581M  888K  581M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.5G   88K  1.5G   1% /run/shm

$ sudo fdisk -l
Disk /dev/sda: >>16.1 GB<<, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders, total 31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c55a4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    15728639     7863296   83  Linux
/dev/sda2        15730686    16775167      522241    5  Extended
/dev/sda5        15730688    16775167      522240   82  Linux swap / Solaris

$ vboxmanage showhdinfo mint.vdi
UUID:                 a94931b9-673c-440a-ab6b-2c3eedd0cf93
Accessible:           yes
Logical size:         15360 MBytes
Current size on disk: 7806 MBytes
Type:                 normal (base)
Storage format:       VDI
Format variant:       dynamic default
Location:             /opt/virtualization/vm/mint.vdi

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

You’ve resized the disk, but not the partition nor the filesystem on that partition. There is now unpartitioned space at the end of the disk.

A partition needs to be contiguous, so you’ll need to move the swap partition to the end of the disk. The easiest way of doing that is to turn off swap (swapoff -a), delete the swap partition /dev/sda5 (and, since it’s a logical partition, also delete the extended partition /dev/sda2), recreate it and turn the swap back on.

After that, extend the system partition /dev/sda1: change its end location to use all the space except the part used by the swap partition.

While this can be done manually with fdisk, I recommend using GParted. Boot from a GParted bootable image in the VM.

After you’ve moved and resized the partitions, expand the root filesystem to use all the space in the partition. You can do that in GParted, or manually with resize2fs /dev/sda1 (this can be done from the running system).

Solution 2

Even thought you’ve resized the underlying device in your VM, nobody has told the actual filesystem that the available space has changed. Your partion table on disk probably hasn’t changed either. So, ext3 sees your root partition as starting at sector X and ending at sector Y. What you did in extending the size of the VDI was add sectors to the end of the VDI. So your ext3 partition beginning at sector X still only extends to sector Y.

What you need now is to do two more things. Update the partition table so that /dev/sda starts at sector X and now extends to the newly available sector Z, then you need to tell ext3 (ext2 really) that it can expand into the new space. In some operating systems this is done with a simple growfs -M /device command. In Linux it seems that this is more complicated, and involves converting your ext3 fs to ext2 (by removing the journal), then expanding your partition.

That site has all the steps you’ll need.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply