Search This Blog

Tuesday, November 3, 2015

Resizing a VirtualBox Windows 7 drive

I originally allocated 30 GB for use as a Windows 7 virtual drive using Oracle's VirtualBox software. I then installed the baseline software: Comodo Anti-Virus, Firefox, and various Windows updates (read: hours of time wasted while watching "Please wait while Windows installs 1 of 238248 updates", etc.). 

"Features" is probably used too liberally

Once I had a good working Windows 7, I created a snapshot to come back to, should something go awry in the future. Once that was done, I installed SketchUp for my woodworking projects and some common access card reader software for my work stuffs (Navy websites). All was working well until this morning when I wanted to install the Home Remote Developer package to design a custom home automation interface. I was hit with "This program requires 2048 MB to install and you have [some random amount lower than this] remaining. Do you want to continue?"  Nope, I would not like to continue. I would like to find out why Windows thinks it needs so much space (30 GB, really?) to operate with a handful of programs installed. I went in to the Add/Remove programs to verify that, yep, I only had the aforementioned programs installed. So I went to disable Windows "features" and removed games, tablet services, and some other useless checkboxes, restarted, and now had even less space (originally was 1.02 GB on C:):

At any rate, rather than getting all spun-up over Windows (did I tell you about Xubuntu yet?), I researched how to make the C: drive bigger in my virtual machine. I quickly came up with this post: How to resize a virtual drive, which, turns out, is exactly what I intended to do. I found out that file resizing does not work if snapshots had been taken (forgot to read inside the parenthesis about prior to 4.3...), so I went into VirtualBox and created a clone with no snapshots of the current state.

Once that was complete, I continued with the guide by using the following script in terminal:

VBoxManage modifyhd <absolute path to file> --resize <size in MB>

Only I wanted to go from 30GB to 40GB, so the exact command was:

VBoxManage modifyhd "/mnt/Media/Virtual Machines/Windows 7 Clone/Windows 7 Clone.vdi" --resize 40960

And that was the first step of the process, by giving VirtualBox a bigger "hard drive" to work with. I then started up the Windows 7 Clone to extend the primary partition into the new space. After opening Disk Management, I was greeted with the unallocated space:

So here, just right click the (C:) > Extend Volume. Follow the menus to extend it out into the unallocated space, and then voila!

Like I said previously, I created a clone to work with, so I wasn't messing around with the original installation. If you are doing this on your working install, make sure you create a backup prior to attempting to resize the drive, as something could possibly get messed up. Also, since I'm running 4.3, I could have possibly done this procedure on the existing snapshot, but creating the clone meant that I could follow the original tutorial and also have a backup to work with.

If you have any comments, feel free to leave them below.

No comments:

Post a Comment