How to Resize Hard Drive on VirtualBox

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:

  1. Shutdown the virtual machine if it’s running.
  2. Open up an elevated command prompt.
  3. Change directory to where your virtual machine’s hard drive file is.
  4. 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.

Be the first to comment

Leave a Reply

Social Widgets powered by

Advertisment ad adsense adlogger