1

Running df -h returns:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       3.9G  3.7G  1.8M 100% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            2.0G  4.0K  2.0G   1% /dev
tmpfs           396M  880K  395M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            2.0G   76K  2.0G   1% /run/shm
none            100M   48K  100M   1% /run/user

For some reason Ubuntu says I only have 4GB hard drive space, but in VirtualBox, under Storage > Controller: SATA it says I have Ubuntu.vdi (Normal, 11.72 GB).

I've tried running resize2fs as well, and it returns:

sudo resize2fs /dev/sda1
resize2fs 1.42.9 (4-Feb-2014)
The filesystem is already 1048320 blocks long.  Nothing to do!

Running fdisk returns:

sudo fdisk -l

Disk /dev/sda: 12.6 GB, 12582912000 bytes
255 heads, 63 sectors/track, 1529 cylinders, total 24576000 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: 0x000ac43a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     8388607     4193280   83  Linux
/dev/sda2         8390654    16775167     4192257    5  Extended
/dev/sda5         8390656    16775167     4192256   82  Linux swap / Solaris

How do I increase disk space of my VM?

4
  • Look at sudo fdisk -l and see what the actual partition scheme is and whether you have any free space at all.
    – Thomas Ward
    Jan 29 '15 at 15:51
  • @ThomasW. that returns Disk /dev/sda: 12.6 GB, 12582912000 bytes and /dev/sda1 * 2048 8388607 4193280 83 Linux
    – ccnokes
    Jan 29 '15 at 15:54
  • put the complete output into your question as an edit, NOT as a comment.
    – Thomas Ward
    Jan 29 '15 at 16:03
  • you have 8 GB of swap assigned to your virtual drive. In case you need more space see: askubuntu.com/questions/88647/…
    – Takkat
    Jan 29 '15 at 16:27
0

Running VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB as mentioned here How do I increase the hard disk size of the virtual machine? is the first step. The partition then has to be resized. Doing this wasn't very straightforward and the best instructions that I could find and that worked are here:

http://logicmason.com/2012/growing-a-hard-drive-partition-in-a-virtualbox-ubuntu-guest/

Basically load the GParted.iso as a Controller:IDE so that it boots on startup. Then, in its UI, you can reallocate disk space and move partitions around. Exit GParted and start Ubuntu and running df-h returns:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        12G  3.7G  7.3G  34% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            2.0G   12K  2.0G   1% /dev
tmpfs           396M  872K  395M   1% /run
none            5.0M  4.0K  5.0M   1% /run/lock
none            2.0G   76K  2.0G   1% /run/shm
none            100M   28K  100M   1% /run/user
/dev/sr0        222M  222M     0 100% /media/cameron/GParted-live
1

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