Saturday, January 7, 2012

Expanding A Disk in Oracle's VirtualBox

I run Ubuntu Linux at home. I love Linux. It's fast, has a smaller footprint than other O/Ss, and it's free. The rest of the world, however, lives on MicroSoft Windows or Apple OSX. I don't mind this. I like being different and enjoy the time I don't spend on virus issues and the money I save on hardware.

Still, ever so often you need a Windows operating system. Normally I can do these small tasks using other resources, but recently I've been hit over and over again with the need to have Windows at home.

If you run Linux you have a few options. You can use Wine to run windows applications within your Linux O/S or you can use a Virtual Machine server to host a Windows O/S within your Linux system. I decided to go this route.

I was once a VMWare fan. I guess I still am but Oracle has a free product called VirtualBox that was recommended by my next door neighbor, the Linux Kernel Commando. The primary advantage to VirtualBox is its ability to access the USB port. VMWare doesn't do that, at least the free version doesn't.

VirtualBox is easy to download, install, and setup as was the Extension Pack which added the USB 2.0 support. Everything was wonderful once I had Google Chrome installed in my new Windows 7 instance. I used it rarely, but it was always there when I needed it. The only issue was when it cranked up, Windows would download the latest MicroSoft patches. I think the VM spent more time patching than running.

Then came my decision to purchase MicroSoft Office 2010. I had 20 GB allocated to my Window's VM and needed more. VirtualBox doesn't have a nice little switch to extend a disk from their console (hint: THEY SHOULD). You have to go to the command prompt and do it. The pig that is Microsoft Office needs over 40 GB to install. After futzing around, making new drives, and generally getting frustrated, I found the magic command to extend a virtual disk.

Before running this, make sure you have a good snapshot of your current VM image. I did a full clone as well just in case.  Here's a screen print of my current VirtualBox console (after the expansion). Note the happy little Snapshots(1) button in the upper right. That's where you go to make the snapshot.


The command to expand the disk to 80 GB is

VBoxManage modifyhd [virtual disk filename] --resize [size in MB]

You find the path to the file from the Storage link on the console above. You can find this and other VirtualBox commands in the Manual.

I was then able to go in and install MicroSoft Office with no problems although I wonder how much more time my little VM will spend patching itself.



No comments: