Ubuntu – VirtualBox dynamic disk not expanding to Virtual Size

12.04vdivirtualbox

I have Ubuntu 12.04 running on VirtualBox 4.2.4 in a Dynamic VDI disk with the limit set to 8gb on a real ext4 partition with more than 40gb of empty room available. However, the VDI it does not expand to the limit. 8gb is more than enough for what I want to do.

How do I make the rest of the space available? Available space in / and .home is 41kb.

vm

vdi

Best Answer

I fixed my VirtualBox machine by setting the path on Windows 7 host machine to include the VirtualBox install directory (Steps):

  1. click start button
  2. Right click computer
  3. Click Properties
  4. Click Advanced System Settings
  5. On [Advanced] tab click [Environment Variables] button
  6. Under System Variables, scroll down to path and click [Edit]
  7. Add everything in quotes to end of line ";C:\Program Files\Oracle\VirtualBox\"
  8. Click [Ok]

Next move to the directory of the VirtualBox Disk (under username\VirtualBox VMs) taken from (https://forums.virtualbox.org/viewtopic.php?f=7&t=52351)

  1. open cmd and move to the VirtualBox drive
  2. enter this command: VBoxManage showhdinfo
  3. Take note of the UUID of the disk.
  4. enter this command: VBoxManage modifyhd UUID_of_the_VDI_disk --resize 80000 (this makes the disk 80 gigs, adjust to the size you want)

IMPORTANT STEPS START HERE: Next boot the Virtual machine on LiveCD (Install disk) (taken from Extending Ubuntu Partition size with the unallocated space (swap is between these two))

I can't stress this enough:

It is highly recommended to backup any important files before doing resize/move/extend operations.

The way to do it, is by deleting the swap partition, extend the partition that you want, and then re-create the swap partition.

Swap partition can only be deleted after swap is turned off:

SWAP off: sudo /sbin/swapoff -a SWAP on: sudo /sbin/swapon -a

The steps:

  1. Boot from the Ubuntu LiveCD
  2. Open terminal, and turn swap off
  3. Install GParted
  4. Extend the partiton that you want, but leave space for swap
  5. commit the changes
  6. create swap partition
  7. turn swap on

Note: If your swap is not your primary hard drive, then see SwapFaq on how to activate the swap partition

It is highly recommended to backup any important files before doing resize/move/extend operations.

Related Question