Tuesday, November 13, 2012

Resizing a VirtualBox hard drive image under Windows

Every once in a while I run out of hard drive space on one of my virtual machines. I used to go through wild gyrations to add an additional hard drive to the machine. It's actually much simpler to just expand the hard drive.

In my case, I'm using a Windows 7 guest OS inside a Windows 7 host OS. I do the following:

  1. Shutdown the guest machine
  2. Start a command prompt and type the following:
    1. "c:\Program Files\Oracle\VirtualBox"\vboxmanage modifyhd Win7CppDev.vdi --resize 30720
  3. You should be able to confirm that the drive is larger in File > Media Manager.
  4. Boot the guest VM
  5. Start Computer Management > Storage > Disk Management
  6. Use "Extend Volume..." on C: partition to use the newly unallocated partition space.
  7. Restart guest OS for good measure, even though I don't think it is needed.
Congratulations, you now have more space.