Increase space on fixed VirtualBox VDI disk containing Windows 7 on Mac

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.

  1. Select your appliance in VirtualBox and click on Settings.
  2. Click on the Storage button.
  3. Select Controller: SATA Controller from the storage tree list.
  4. Underneath the storage tree list, click on the add attachment button (disk icon with plus sign).
  5. Select Add Hard Disk, followed by the Create new disk button.
  6. Select VDI (VirtualBox Disk Image) and press Continue.
  7. Select Fixed size and press Continue.
  8. 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.

  1. Open up Terminal.
  2. 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
    1. Breaking the above command down:
    2. Program: /Applications/VirtualBox.app/Contents/MacOS/VBoxManage clonehd
    3. Existing disk: /Users/username/VirtualBox\ VMs/Windows\ 7\ Pro/Windows\ 7\ Pro.vdi.
    4. New disk: /Users/username/VirtualBox\ VMs/Windows\ 7\ Pro/Windows\ 7\ Pro\ New.vdi.
    5. Existing disk flag: --existing.
    6. 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.
  3. 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.

  1. Start your Windows appliance and login.
  2. Find your Computer, right-click on it, and select Manage.
  3. Toward the left, click on Disk Management (under Storage).
  4. Find your C: drive to the right, right-click on it, and select Extend Volume.
  5. 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.

9 thoughts on “Increase space on fixed VirtualBox VDI disk containing Windows 7 on Mac

  1. Cory Lowe

    Hi Ryan,
    I used your tutorial (http://ryansechrest.com/2014/03/increase-space-fixed-virtualbox-vdi-disk-containing-windows-7-mac/) in attempt to expand the disk space on a fixed size VM. However, when I run the command I get the error message below stating that the original drive already exists. I was wondering if you had any advice to offer?
    Thank you for any help you have to offer,
    Cory Lowe

    My commands and error messages are below:

    Claytons-iMac:~ CoryLowe$ /Applications/VirtualBox.app/Contents/MacOS/VBoxManage clonehd /users/corylowe/virtualbox\ VMs/Windows\ XP/Windows\ XP.vdi /users/corylowe/virtualbox\ VMs/Windows\ XP/100\ GB.vdi --existing
    
    VBoxManage: error: Cannot register the hard disk '/users/corylowe/virtualbox VMs/Windows XP/Windows XP.vdi' {403ba968-4361-4d09-a58a-4f434ef115fd} because a hard disk '/Users/CoryLowe/VirtualBox VMs/Windows XP/Windows XP.vdi' with UUID {403ba968-4361-4d09-a58a-4f434ef115fd} already exists
    VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBox, interface IVirtualBox, callee nsISupports
    VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp
    Reply
    1. Ryan Sechrest Post author

      Hi Cory,

      Did you at some point rename your Windows XP or any of the other directories in that path?

      I did a bit of research on that (since I’ve never run into this) and it could either be (a) that you were not using absolute paths (which it looks like you were) or (b) that you at some point renamed a directory in that path (e.g. Windows XP) and VirtualBox still thinks that location exists.

      If you run VBoxManage list hdds, do all your disks live in the path indicated?

      What you might try is to unregister that UUID within VirtualBox’s registry by running:

      VBoxManage closemedium disk 403ba968-4361-4d09-a58a-4f434ef115fd

      And then try cloning it again:

      VBoxManage clonehd "/users/corylowe/virtualbox VMs/Windows XP/Windows XP.vdi" "/users/corylowe/virtualbox VMs/Windows XP/100 GB.vdi" --existing

      Reply
  2. Luc

    Hi,

    Nice explanation, it’s work well for me.

    Maybe we should add this before “Point 3 Increase your Windows partition”

    In “VirtualBox/Settings/Storage” Select your new drive and attribute to it “Port SATA 0” to be able to boot with the new drive.

    Thank you very much !

    Luc

    Reply
  3. ines

    Thank you very much!!! i struggled 2 days to expand storage in my virtual box using a mac, until i found your post! your explanation are great, thanks a lot 🙂

    Reply
  4. David

    Worked like a charm for me, thanks!
    One remark though, it might be worth mentioning that you have to remove the old vdi file from the storage settings first, because otherwise ‘extend volume’ will be greyed out, even though Windows can already see how much free space it can allocate.

    Reply
  5. sadhanandham

    Came across this site for expanding my fixed Hard disk size and worked like a charm. Found n number of solutions but this one helped me to achieve the same with just one additional disk.

    Thanks.

    Reply
  6. Fabien

    Hello, I came accross your tutorial and i have to admit that it was a big relieve. I can’t believe that they were nothing regarding this extension issue. I have followed your steps until the last part where i have to select the C drive and extend the volume. However, it’s gray out and does not allow me to select it 🙁 can you please advise on what to do? I was trying to attach a shot of it with no success.
    Thank you very much.

    Reply

Leave a Reply

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