When I first created a Windows XP virtual machine using VirtualBox, I thought 20GB was enough for me. However, as I relied on the virtual machine for all XP related works, I soon filled up the hard drive with all the test programs. I wanted to increase the size of the virtual machine’s hard drive, but there wasn’t a GUI option to do so. I finally found a post about using a command line utility to resize the hard drive. Here are the steps on my Windows 7 machine, based on the information from the post:
- Shutdown the virtual machine if it’s running.
- Open up an elevated command prompt.
- Change directory to where your virtual machine’s hard drive file is.
- Type this command to resize the hard drive. Substitute the MyVirtualHardDrive.vdi with your hard drive’s file name and the number 40960 with the size you want in MB.
"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "MyVirtualHardDrive.vdi" --resize 40960
You will see the size increase the next time you boot up the virtual machine. Note that even though the hard drive size has been increased, the partition is the same. You’ll need to use a different tool to increase the partition to fit the hard drive. On Windows machines, you can use DISKPART to do it. Otherwise, the GPartED is a great tool for Linux.
This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.