I use a lot of virtual machines for the work I do. Invariably, I start with small virtual hard drives that continuously grow until I run out of space. 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. Locate your virtual disk file which is probably stored in your Virtual Machine directory. In my case, it was in C:\VirtualMachines\Win7CppDev and it was called Win7CppDev.vdi. Adjust your appropriately.
  3. Determine what size you want for the drive. Mine started at 20GB, so I want to expand it to about 30 GB.
  4. Start a command prompt and type the following:
    C:\Program Files\Oracle\VirtualBox”\vboxmanage modifyhd Win7CppDev.vdi –resize 30720
  5. You should be able to confirm that the drive is larger in File > Media Manager.
  6. Boot the guest VM
  7. Start Computer Management > Storage > Disk Management
  8. Use “Extend Volume…” on C: partition to use the newly unallocated partition space.
  9. Restart guest OS for good measure, even though I don’t think it is needed.

Congratulations, you now have more space.

Leave a comment

Your email address will not be published. Required fields are marked *