I use VirtualBox on my Mac to have other operating systems at my disposal. One of my appliances contains a copy of Windows 7 with a fixed, 25GB disk. I’ve run out space and was looking for an easy way to increase it.
I came across the
modifyhd command, which in theory let’s you increase the disk space, but it only works on dynamic disks. I opted for performance (fixed disk) when I set up the appliance, and this minor inconvenience is the price.
There are several tutorials out there, but many of them require third-party applications, either on the Mac or in Windows side. The thing is, even without those utilities, it’s fairly easy to increase your disk space.
What we’ll do is create a bigger disk, clone the contents from the small disk to the big disk, and then increase our Windows partition.
1. Create a new VirtualBox disk
First, we’re going to create a new disk with the desired size.
- Select your appliance in VirtualBox and click on Settings.
- Click on the Storage button.
- Select Controller: SATA Controller from the storage tree list.
- Underneath the storage tree list, click on the add attachment button (disk icon with plus sign).
- Select Add Hard Disk, followed by the Create new disk button.
- Select VDI (VirtualBox Disk Image) and press Continue.
- Select Fixed size and press Continue.
- Give it a name, set your desired disk size, and click Create.
2. Clone small disk to large disk
Second, we’ll copy all of the contents from your existing disk to the new disk.
- Open up Terminal.
- Run the following command:
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage clonehd /Users/username/VirtualBox\ VMs/Windows\ 7\ Pro/Windows\ 7\ Pro.vdi /Users/username/VirtualBox\ VMs/Windows\ 7\ Pro/Windows\ 7\ Pro\ New.vdi --existing
- Breaking the above command down:
- Existing disk:
/Users/username/VirtualBox\ VMs/Windows\ 7\ Pro/Windows\ 7\ Pro.vdi.
- New disk:
/Users/username/VirtualBox\ VMs/Windows\ 7\ Pro/Windows\ 7\ Pro\ New.vdi.
- Existing disk flag:
- Be sure to change the items in red (and anything else you may have customized). The backslash before each space is necessary to escape the space.
- You should see a progress indicator that will let you know when it’s complete.
3. Increase your Windows partition
Lastly, now that the disk has increased in space, we need to expand our Windows partition to utilize the newly-added space.
- Start your Windows appliance and login.
- Find your Computer, right-click on it, and select Manage.
- Toward the left, click on Disk Management (under Storage).
- Find your C: drive to the right, right-click on it, and select Extend Volume.
- Click Next, then Next one more time, followed by Finish.
If you inspect your hard drive now using Explorer, you’ll find the added space.