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:
- Shutdown the guest machine
- 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.
- Determine what size you want for the drive. Mine started at 20GB, so I want to expand it to about 30 GB.
- Start a command prompt and type the following:
C:\Program Files\Oracle\VirtualBox”\vboxmanage modifyhd Win7CppDev.vdi –resize 30720
- You should be able to confirm that the drive is larger in File > Media Manager.
- Boot the guest VM
- Start Computer Management > Storage > Disk Management
- Use “Extend Volume…” on C: partition to use the newly unallocated partition space.
- Restart guest OS for good measure, even though I don’t think it is needed.
Congratulations, you now have more space.