Posts tagged ‘virtualisation’

Adventures with Virtual Box

0saves

- Booting from an existing Linux partition inside Windows Vista

Recently I`ve been playing with Sun`s Virtual Box virtualisation application, needing to gain a bit more experience with Linux (particularly Red Hat, a distribution I`m not really keen on) and Solaris.  The laptop is currently a dual boot affair with Windows Vista (I`m less keen on this than Red Hat, to the point of despise) and Ubuntu Intrepid Ibex.

Ubuntu Linux running from partition - Sun Virtual Box

Ubuntu Linux running from partition - Sun Virtual Box

Having been a bit of a VMWare fan since probably 1999, I thought I`d take a look at Virtual Box and see if it offered anything new or interesting.  So far, things have been pretty promising.  The application feels a lot less sluggish than VMWare.

Although I prefer to work exclusively in Ubuntu, there are times I need to run Vista, or simply can`t be bothered to reboot.  So, after a bit of searching, it appears I can run Virtual Box inside Vista and run from the Linux partition, something I did regularly with VMWare.  Why would you want to do this?  Isn`t this like driving a Ferrari in first gear?  Well yes – anyone who has tried virtualising one system within the other will tell you that a Linux kernel always delivers a better experience when executing Windows than vice versa.  But that`s not going to surprise anyone.

Installed on the disk: Vista, Ubuntu Ibex, GRUB
Host: Vista (eesh)
Guest: Ubuntu

Now for the science bit.

Open a DOS box as Administrator:

Start -> Programs -> Accessories -> Command Prompt  : right clicky and “Run as Administrator”
Swear at the UAC warning

Enter something similar to the following, watching the sodding quotes.  The path to your Virtual Box installation may be different, and c:\temp may not be a great location for your configuration.  However, this will do as an illustration:

C:\temp>"c:\Program Files\Sun\xVM VirtualBox\"\vboxmanage.exe internalcommands createrawvmdk -filename c:\temp\test.vmdk -rawdisk \\.\PhysicalDrive0

Hit return – the hard bit.  With a bit of luck, you`ll see the following:

VirtualBox Command Line Management Interface Version 2.1.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.
RAW host disk access VMDK file c:\temp\test.vmdk created successfully.

Next run Virtual Box as Administrator: find the application in the Programs menu, right clicky, “Run as Administrator” – swear again.  Create a new virtual machine, point its “virtual disk” at the file above (c:\temp\test.vmdk in this instance), and start it up!  At the GRUB menu, choose the Umbongo Linux entry as normal.  With a bit of a luck, a few minutes later and all should be well with the world, including networking.

A word of warning: it`s never a good idea to attempt to boot an operating system inside itself, so don`t be tempted to try Vista inside Vista or Linux inside Linux.  I did this a couple of times by accident in VMWare (GRUB automatic boot countdown as I went for a coffee) and spent way too long with fsck getting everything working again.

Just to emphasise: Windows`s shitty UAC gets in the way of everything, so these steps must be carried out as Administrator, otherwise you face lots of “unable to access file” type errors.  Lovely!