Triple Boot, Part 4: Windows via VirtualBox

<< Back to Part 3, Install OpenSolaris

After setting up my triple-boot system, I was not content.  I want access to Windows Vista and Ubuntu 8.04 without having to restart my system.  I mostly run OpenSolaris and rebooting to switch to Vista or Ubuntu is a disruption.  If I need to do some sort of benchmarking or a lengthy task on Vista or Ubuntu then it is worth the time to reboot.  But there are several use cases where I just want to do something quickly and then go back to what I was doing in OpenSolaris.

With Vista, typically I just want to edit an OpenOffice document, usually a presentation.  I frequently edit presentations that were originally created by someone who was running OpenOffice on Windows.  Since OpenOffice does not embed the actual fonts in the document, editing a document created on Windows while running OpenOffice on a non-Windows operating system can cause problems.  Even with fonts such as Arial - Arial on Windows is not exactly the same as Arial on OpenSolaris, Ubuntu, etc.  As a result, items in the documents frequently do not align correctly.

So I need the ability to quickly and easily run Windows Vista for just a few minutes without having to shutdown OpenSolaris, boot Vista, and then shutdown Vista and restart OpenSolaris.  There is an easy solution: VirtualBox.

Installing VirtualBox is painless, just be sure to download the correct version for OpenSolaris: 32 or 64 bit.  On my system, which has an Intel Core 2 Duo chip, OpenSolaris runs in 64-bit mode, as confirmed by the isainfo command:

gs145266@opensolaris-gs-08.05:~$ isainfo -k
amd64  

VirtualBox is a small download and it installs quickly.  It is very easy to use - I did not need the documentation until I started doing advanced configuration type stuff.

In VirtualBox I created a virtual machine for Windows Vista and then I had to make a choice:

  1. Use the existing Vista installation that was already on my hard disk.  In other words, configure the virtual machine to use the NTFS partition on my hard drive and let it boot Windows Vista from the same installation that boots from the bare metal.
  2. Create a virtual disk image (.vdi) file and configure the virtual machine to use it.  The .vdi file would be empty, so this would require getting a Vista DVD so that I could run the Windows installer, etc.

I ultimately decided to go with option 2 because of complications with option 1:

  • There are some Windows configuration and activation issues.  There is a very detailed tutorial available that describes how to accomplish option 1 with Ubuntu as the host operating system and Windows XP as the guest operating system that is running in the virtual machine.  I assume the same basic approach would work with OpenSolaris as the host and Vista as the guest, but I am not very knowledgeable about the differences between XP and Vista, especially in the all-important area of hardware profiles (which are key to making option 1 work).
  • VirtualBox has a nice feature that I like to use called "guest additions." These are device drivers that get added to the guest operating system to enable full screen mode, seamless mode, better mouse integration, etc.  According to that tutorial, if you choose option 1 then installing the guest additions is a bad idea because after the guest additions are installed, Windows will no longer boot from the bare metal.

Option 2 was easy to setup and then I was able to run the installer for Windows Vista from a DVD. I added the VirtualBox guest additions and everything worked great.

There was just one problem: when running Vista in that VirtualMachine, I have no access to all that data on my hard drive's NTFS partition. It should be noted, this is not a limitation of VirtualBox - it is possible to configure "shared folders" that allow the installation of Vista that is running in a virtual machine to read/write any directory that OpenSolaris can access.

The problem is that OpenSolaris 2008.05 cannot access my NTFS partition because it does not include any support for NTFS partitions.  You can add some packages to it in order to get read-only support for NTFS (see this entry from Pradhap for details), but I would like to be able to write files to the NTFS partition as well.

Once again, VirtualBox provides a solution. 

VirtualBox supports raw access by a virtual machine to the host operating system's disk drives.  The details are provided in section 9.9 of the VirtualBox 1.6.2 User Guide, which you will need to study before attempting this on your own system.  Section 9.9 includes this important warning:

Warning: Raw hard disk access is for expert users only. Incorrect use or use
of an outdated configuration can lead to total loss of data on the physical
disk. Most importantly, do not attempt to boot the partition with the cur-
rently running host operating system in a guest. This will lead to severe data
corruption.

I wanted to provide access to the NTFS partition only, so I attempted to follow the instructions in section 9.9.2 of the documentation.  Unfortunately, the VBoxManage command described in section 9.9.2 does not work in VirtualBox 1.6.2 when run on OpenSolaris - the bug is documented here.

Luckily, I have other operating systems installed on this machine.  :-)  I booted up Ubuntu and used the VBoxManage in my installation of VirtualBox on Ubuntu to find out the partition numbers used by VirtualBox:

gs145266@gs145266-laptop-ubu-804:~$ sudo VBoxManage internalcommands listpartitions -rawdisk /dev/sda
[sudo] password for gs145266: 
VirtualBox Command Line Management Interface Version 1.6.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.
Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x27  0   /32 /33  888 /172/52          6970         2048
2       0x07  888 /172/53  1023/254/63         63415     14276608
3       0xbf  1023/254/63  1023/254/63         72927    144151245
5       0x83  1023/254/63  1023/254/63           972    293507613
6       0x82  1023/254/63  1023/254/63          3827    295499673
7       0x83  1023/254/63  1023/254/63         42667    303339393

Partition 2 is the NTFS partition, so I created the files described by section 9.9.2 by using this command:

gs145266@gs145266-laptop-ubu-804:~$ sudo VBoxManage internalcommands createrawvmdk -filename /home/gs145266/part2Access.vmdk -rawdisk /dev/sda -partitions 2
VirtualBox Command Line Management Interface Version 1.6.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.
RAW host disk access VMDK file /home/gs145266/part2Access.vmdk created successfully.

In addition to part2Access.vmdk, VBoxManage also created part2Access-pt.vmdk.  I copied both files to a USB drive and then rebooted the system in order to bring up OpenSolaris. 

The content of part2Access.vmdk was:

# Disk DescriptorFile
version=1
CID=4920ffa0
parentCID=ffffffff
createType="partitionedDevice"

# Extent description
RW 63 FLAT "part2Access-pt.vmdk"
RW 1985 ZERO 
RW 14274560 ZERO 
RW 129874637 FLAT "/dev/sda" 14276608
RW 149356367 ZERO 
RW 1 FLAT "part2Access-pt.vmdk" 63
RW 1991997 ZERO 
RW 63 FLAT "part2Access-pt.vmdk" 64
RW 7839657 ZERO 
RW 63 FLAT "part2Access-pt.vmdk" 127
RW 87382575 ZERO 

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="ide"
ddb.geometry.cylinders="16383"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
ddb.uuid.image="840529aa-1989-46ce-c09e-7d3bbec98243"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"

Note the value in bold: /dev/sda, which of course is the device name for my hard disk in Linux.  I changed it to the value that OpenSolaris would expect on my system: /dev/dsk/c5d0p0 and then saved the file.

The final step was to make it available to the virtual machine.  In order for this to work, VirtualBox has to be run with enough privileges to get raw access to the disk drive.  So I modified the GNOME menu entry for VirtualBox so that it is started by pfexec:

After starting VirtualBox, I added part2Access.vmdk as a virtual disk by using File > Virtual Disk Manager > Add. Then I was able to add it as the IDE Primary Slave device for my Vista virtual machine:

And now when I run Vista in that virtual machine, it sees my NTFS partition on my hard disk as drive E:


Comments:

VirtualBox is a great software and it save my life lot of time(!), I develope some old software written in VisualC++ inside VirtualBox+WinXP. There is only a big issue, VirtualBox under OpenSolaris can't access USB devices, not a big problem for me but cold be for a lot of users (ex. access to USB stick, iPod ecc...).

Posted by Luca Morettoni on July 22, 2008 at 12:16 AM GMT #

I run vbox over a Debian host with (at the moment) XP and Ubuntu and Kubuntu as guest VMs. I've run OpenSUSE11 and OpenSolaris10 in the past. In the future, who knows.

I simply configure shared folders to my /home/username directory and let all guest VM apps access all my user data. IMO, that's the whole point of desktop virtualization, to use the best available apps on a common data pool and not have to care which OS those apps are on.

I'm moving off VMware Server over their decision to scrap the console and make access to their VMs via crash-prone web browsers only.

Posted by A.Lizard on July 26, 2008 at 04:25 PM GMT #

Hi Luca - USB support when running VirtualBox on OpenSolaris is scheduled to be added to version 2.0 of VirtualBox. The target release date for version 2.0 of VirtualBox is August, 2008, so hopefully it will be available soon. HTH - Gregg

Posted by Gregg Sporar on August 06, 2008 at 10:30 AM GMT #

Great!! Is a very fantastic news!!!! ;)

Posted by Luca Morettoni on August 07, 2008 at 08:58 AM GMT #

I was able to get Skype for Windows working on Ubuntu using VirtualBox Seamless Mode. I imagine this would work great on OpenSolaris too, as long as sound works properly. I wrote a blog entry about it. Click my name to read about it.

Posted by Ryan de Laplante on August 07, 2008 at 06:33 PM GMT #

There is another method to access Windows partition without using Linux (in my installation I have WinXP + OpenSolaris), you need to:
install VirtualBox into WinXP
run the "VBoxManage internalcommands ..." replacing /dev/sda with \\\\.\\PhysicalDrive0.

After you can make adjustement into OpenSolaris and all work fine!!!

Posted by Luca Morettoni on August 19, 2008 at 05:03 AM GMT #

how i connect the usb to the os exicute with vbox
in winXP sp3.

Posted by awi on September 17, 2008 at 02:43 AM GMT #

At the moment VirtualBox 2.0.2 installed into OpenSolaris host has NO usb proxy support...

Posted by Luca Morettoni on September 17, 2008 at 03:06 AM GMT #

You can use Win4Solaris instead of virtual box and you will get full USB support and you can even do crazy stuff like USB over IP! The only draw back is that Win4Solaris probably costs somewhere around $30 or $40 for a home license whereas VirtualBox is free.

Posted by SolarisRocks on October 02, 2008 at 02:45 AM GMT #

Check out this youtube video for a demonstration of USB compatibility with a Windows guest OS running under a Solaris host OS:

http://www.youtube.com/watch?v=InTXdk_FHv0

This second video shows how you can stream Windows XP desktops to Sun Ray thin clients:

http://www.youtube.com/watch?v=BCNWB_slB-Y

Posted by SolarisRocks on October 02, 2008 at 02:47 AM GMT #

On a Windows Server Host. What's the command to autostart a virtualbox client (another windows server)

Posted by Mike Carvajal on October 29, 2008 at 06:23 AM GMT #

Hi,

Where can I find tutorial to build existing vista image?

Tq

Posted by Monette on April 08, 2009 at 12:38 AM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today