Thursday, August 06, 2009

VirtualBox on Windows Hosts

A friend of mine has just written up his comments on installing Ubuntu as a virtual machine on a Windows host using VirtualBox 3.0.0 (the latest version at the time of writing, 3.0.4 has been released now). It's clear from his instructions that this is a fairly simple process, with the possible exception of a gotcha around networking. However, I did notice one other issue with his instructions that will probably come back to haunt him in some six months time or so... and when it happens it will be hard to find the cause.

As a side note, I'm also using VirtualBox, but on an Ubuntu host, to enable me to have a Windows XP running occassionally whilst I use Ubuntu for most work, even though I am writing this whilst running Vista (dual boot on the same machine).

Andy, you might want to be careful about using a dynamically expanding disc file for your root file system. NTFS is notorious for fragmenting files as they grow - especially if your file is living on a partition with other activity. And as we all know, the more fragmented a file gets, the poorer the performance becomes as the disc heads have to seek across more and more diverse areas of the disc to get to the content of the file. Where you have a virtual file system in a file, this is only going to get worse, because the file system you have inside the file will have no knowledge of how the data is distributed over the real disc, so it can't make any decisions over data distribution within the file system that have any meaning on the disc platters.

To avoid this, you need to be able to set a specific size for the virtual disc file. However, this will require a little pre-set-up work. First you need to decide on what is a sensible, reasonably future-proof size for your root partition. I notice that the VirtualBox installer chose 8.6GB ... that sounds quite reasonable to me, though I'd be tempted to go for 10-12GB myself. Next, you need to defragment your chosen disk partition until there is a region of free space at least as large as your desired file, and as few other gaps as possible (in order to give NTFS as little choice over where it puts the file as possible).

Now you can click the VirtualBox "New" button, to create your virtual machine.

This same issue affects the Windows page files, by the way.

No comments:

Post a Comment