29

I use VirtualBox 4.2.6 with Ubuntu 12.04 as a host and Win XP as a guest. I assigned a virtual disk (VDI) that grows with XP to a a maximum of 40 GB. Currently it uses 25 GB.

Within XP it repeatedly tells me that there is not enough space available.

I still have plenty of space on my host's primary disk

df -h
/dev/sda1       143G     48G   89G   35% /

What to do to expand my XP's disk? This question did not help me, btw.

enter image description here

2 Answers 2

21

We have no idea why Windows in your case can not handle the dynamically allocated virtual disk. It may be worth to check the filesystem integrity or perform a defragmentation from your Windows guest OS.

Nevertheless we can easily increase the size of a dynamically growing virtual drive reported to the guest OS by issueing the following command run in a terminal:

VBoxManage modifyhd <uuid/name> --resize <newsize in MB>

Replace with the uuid or the filename (full path needed) of your virtual drive. These can be listed with the following command:

VBoxManage list hdds

Note that obviously we can not change the virtual drive size if we had taken snapshots or saved the machine's state instead of power off. Before we change the virtual drive's size we therefore need to delete all snapshots, or work on a clone to makes sure we do not loose a snapshot's content. Shrinking a dynamically growing disk is not possible.

After having resized the virtual drive we will then have to adapt the partition table of the guest to altered drive's size.

In Windows 7 go to Computer Management -> Disk Management to view new unallocated space (shown after resizing with adding 10 GB to the drive):

enter image description here

Right click on this unallocated partition to select "Extend Volume..." to increase the partition size. You may also do this with booting an Ubuntu live .iso on this virtual machine to resize partitions using gparted.

More details here: Virtual Box User Manual

See also: How do I increase the hard disk size of the virtual machine?

To physically shrink/compact a dynamically growing disk see: How do I shrink a dynamically growing VDI disk from VirtualBox?

6
  • 2
    if you have snapshot, this does not work (looks like it work, but really not), so the only way seems to be to delete the snapshopt (and this can take some time),then do it.
    – Sverre
    Sep 4, 2014 at 4:54
  • I would if I could, but my remove snapshot does not work (it dies, known bug it looks like), so I currently have created a new virtual drive (fixed size) and I am cloning it now from inside winwos vm.
    – Sverre
    Sep 4, 2014 at 8:47
  • How would you "work on a clone"?
    – B T
    Oct 5, 2014 at 7:05
  • VBoxManage is not a valid command on my Windows. Btw, I have the same problem on Windows 10 with VirtualBox 5.1.30. I don't have a separate VBox partition Oct 17, 2017 at 7:52
  • @CGFoX Windows is off topic here but see superuser.com/questions/716649/…
    – Takkat
    Oct 17, 2017 at 8:05
4

You could have added a 40,04GB growing disk, but the Windows partition itself should have been created with the full size at installation time.

Add a Ubuntu CD to your virtual machine and boot with it. Launch gparted on the dash. Open the disk.

You should see a 40,04GB partition and no free space. If you see a smaller partition and free space, use this own tool to resize and grow the existing partition.

After resizing and restarting your virtual machine, Windows will do a partition check, please let Windows do it at least this time! It's important. Don't worry too much about your data though, it's a normal procedure when resizing NTFS partitions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .