VirtualBox and expanding drive sizes…


Hi, I’m Joe, and I’m a Mac user.

Before that scares you away, realize I’m an atypical Mac user. I’m a Microsoft certified IT guy, and eat quite a bit of the MS dogfood. However, my laptop of choice is the MacBook Pro (discussed here) and I use it constantly as my only portable workstation.

I use many apps on my Mac, but the one I use most lets me use many of the others, and that’s Oracle’s (Sun’s) VirtualBox. It’s a great, free virtualization software package, and I use it constantly. My Windows x64 7 VM is in use most of the time, but in addition, right now I also have Windows XP Professional x32, Windows Vista Business x32, Ubuntu, Windows Server 2003 Enterprise R2 x64, and Windows Server 2008 R2 provisioned and running for various projects.

Usually I give my VMs plenty of drive space for 2 reasons. First, many of my VMs are temporary, and I’ll blow them away when I’m done, and second, VirtualBox supports thin provisioning, so even if I’m a little too aggressive in allocation, the VM won’t take up any more space than I need.

Anyway, I’m writing this because I have come across more than a few posts out in the wild from people who are running out of space on their VMs and are desperate for a way to expand the disk. Now there are already a great many documents out there about how to convert the VirtualBox .vdi file to a VMware .vdmk file by using the VMware standalone converter, then using the VMware tools from a VMware install to expand the .vdmk, and then moving the .vdmk back to VirtualBox (because VirtualBox will support both .vdi and .vdmk file formats).

That’s a pretty complex solution, and although I did it once for fun, I could see where it might be beyond the average user.

There are other documents out there involving creating a second virtual drive, and then using an imaging software like Ghost or Disk copy. I like that option better, but it still involves you using a tool that may or may not give an average user difficulty.

So, here’s a simple solution if you are trying to expand your Windows 7 machine’s .vdi based virtual disk

1) Create a backup of your existing .vdi (always a good idea)!

2) In file – virtual media manager, create a new, empty .vdi file of the size you would like

3) Make your new .vdi the primary slave of the virtual machine attached to the drive you wish to expand. The existing drive should be the primary master

4) Boot your VM (Windows 7)

5) In Disk Management of the VM, mirror the existing drive (all partitions) to the new blank drive

6) Allow the mirroring to complete

7) Shut down the VM

8) Detatch the original .vdi in the VM settings, move the new drive to primary master. Don’t delete the old .vdi – this is our path to recovery.

9) Boot the VM. The boot dialog will now give two choices – Windows 7, and Windows 7 – secondary plex. Select secondary plex.

10) Allow OS to start. Verify everything works as it should.

11) Set the secondary plex as default boot in msconfig (Windows 7 has no boot.ini).

I didn’t go into terribly too much detail on this, I am assuming some familiarity with VirtualBox and Windows Disk Management. If anyone has questions or difficulties, leave a comment. I’ll help if I can.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s