Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question
What filesystem do you have on /? That'll need to be resized too probably. – Mat Sep 16 '12 at 13:02
up vote 1 down vote accepted

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).

share|improve this answer
true, i almost did the same except i deleted and recreated all the partitions using fdisk. Can you recommend me some good study material on filesystems and partitions? – rag Sep 17 '12 at 8:04

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.

share|improve this answer
hi, thanks for pointing out. i did not follow the tutorial. i resized the partition using fdisk and used resize2fs to make the file system manager use the entire newly extended partition. it worked. – rag Sep 16 '12 at 22:06
Growing an ext2/ext3/ext4 filesystem in Linux is straightforward, there's no need to remove the journal or anything like that, and extending (but not shrinking) can be done while the filesystem is mounted, with resize2fs. – Gilles Sep 16 '12 at 22:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.