
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Common Sense Chronicles &#187; Linux</title>
	<atom:link href="http://www.rajatarya.com/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rajatarya.com</link>
	<description>glimpses of sanity on technology and productivity by rajat arya</description>
	<lastBuildDate>Sat, 28 Jan 2012 14:59:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Taming Windows 7 in a VirtualBox VM Using Raw Disk Access</title>
		<link>http://www.rajatarya.com/website/taming-windows-virtualbox-vm</link>
		<comments>http://www.rajatarya.com/website/taming-windows-virtualbox-vm#comments</comments>
		<pubDate>Wed, 04 Nov 2009 16:43:55 +0000</pubDate>
		<dc:creator>Rajat Arya</dc:creator>
				<category><![CDATA[technical]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.rajatarya.com/?p=644</guid>
		<description><![CDATA[Image via Wikipedia (This is even more technical than my other technical posts. Consider yourself warned.) I wanted a dual-boot system between Windows 7 and Ubuntu 9.10 64-bit.&#160; I wanted both systems to be fully functional as 64-bit operating systems &#8230; <a href="http://www.rajatarya.com/website/taming-windows-virtualbox-vm">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 138px;">
<dt class="wp-caption-dt"><a href="http://en.wikipedia.org/wiki/Image:Virtualbox_logo.png"><img title="VirtualBox" src="http://upload.wikimedia.org/wikipedia/en/d/d5/Virtualbox_logo.png" alt="VirtualBox" height="128" width="128"/></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://en.wikipedia.org/wiki/Image:Virtualbox_logo.png">Wikipedia</a></dd>
</dl>
</div>
</div>
<p><em>(This is even more technical than my other technical posts. Consider yourself warned.)</em></p>
<p>I wanted a <a class="zem_slink" title="Multi boot" rel="wikipedia" href="http://en.wikipedia.org/wiki/Multi_boot">dual-boot</a> system between <a class="zem_slink" title="Windows 7" rel="homepage" href="http://www.microsoft.com/windows/windows-7/default.aspx">Windows 7</a> and <a class="zem_slink" title="Ubuntu" rel="homepage" href="http://www.ubuntu.com/">Ubuntu</a> 9.10 64-bit.&nbsp; I wanted both systems to be fully functional as 64-bit operating systems and have full access to the computer&#8217;s hardware.&nbsp; Accomplishing <a class="zem_olink" title="Dual-Booting Linux And Windows: Easier Said than Done" href="http://www.slumpedoverkeyboarddead.com/2009/10/29/dual-booting-linux-and-windows-easier-said-than-done/">this</a> has been <strong>well</strong> documented and I won&#8217;t bother discussing it.&nbsp; I simply repartitioned the hard drive into two partitions, and then let Windows 7 install on one of them and then installed Ubuntu 9.10 on the other.&nbsp; Grub gives me a choice when the machine boots and defaults to <a class="zem_slink" title="Linux" rel="wikipedia" href="http://en.wikipedia.org/wiki/Linux">Linux</a>, which is what I wanted.&nbsp; Then I decided I want to run Windows 7 in a VM on the Linux machine, and that I really wanted the VM to run from the Windows 7 partition already created.&nbsp; I had heard this was possible with earlier versions of Windows, so I figured Windows 7 should be no exception (at least if Vista can support such a scenario then Windows 7 should be the same).</p>
<p>I started by reading <a href="http://cargowire.net/articles/seamlessubuntuwindows" target="_blank">this</a>, which gave me good guidance, but was the other configuration &#8211; Windows as the host and Ubuntu as the guest &#8211; I wanted the opposite &#8211; Ubuntu as the host and Windows as the guest.&nbsp; That led me to the <a href="http://www.virtualbox.org/manual/UserManual.html#rawdisk" target="_blank">VirtualBox User&#8217;s Guide</a>, which does a great job of describing the process of using Raw Disk access.&nbsp; And finally, I did some perusing of the <a class="zem_slink" title="VirtualBox" rel="homepage" href="http://www.virtualbox.org/">VirtualBox</a> forums to find a couple specific answers to getting the setup working.</p>
<p>In an effort to help document this scenario, here are the things I did to get it <strong>working</strong>:</p>
<ol>
<li>Read the VirtualBox User&#8217;s Guide on Raw Disk Access (<a href="http://www.virtualbox.org/manual/UserManual.html#rawdisk">here</a>)</li>
<li>

<div class="wp-terminal">user@computer:$ VBoxManage internalcommands listpartitions -<a class="zem_slink" href="http://en.wikipedia.org/wiki/Rawdisk" title="Rawdisk" rel="wikipedia">rawdisk</a> /dev/sda<br/>VirtualBox Command Line Management Interface Version 3.0.8<br/>(C) 2005-2009 Sun Microsystems, Inc.<br/>All rights reserved.<br/><br/>Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)<br/>1       0x07  0   /32 /33  12  /223/19           100         2048<br/>2       0x07  12  /223/20  1023/254/63         99900       206848<br/>3       0x07  1023/254/63  1023/254/63         70000    204802048<br/>5       0x83  1023/254/63  1023/254/63         65624    348176808<br/>6       0x82  1023/254/63  1023/254/63          2839    482576598<br/></div>

</li>
<li>Notice how there is a 100MB partition (partition 1) &#8211; that is the boot partition for Windows 7.  This, along with partition 2 are the Windows 7 partitions.  Partition 3 is my &#8216;data&#8217; partition, which is shared between both OSes.  All of these partitions need to be enabled for read/write access by me in order for VirtualBox to load them up.  I did this by:

<div class="wp-terminal">user@computer:$ chmod 666 /dev/sda1<br/></div>


<div class="wp-terminal">user@computer:$ chmod 666 /dev/sda2<br/></div>


<div class="wp-terminal">user@computer:$ chmod 666 /dev/sda3<br/></div>

<p>I know this is not the most secure way of doing things, but it works for me.</li>
<li>Now it is also important that there is a place for Master-Boot Record (MBR) to get loaded from VirtualBox.  This is necessary so that when the VM starts up it has an MBR to use &#8211; otherwise it will try to use Grub and will fail miserably.  To get a &#8216;dummy&#8217; MBR created I read a couple forum posts (<a href="http://forums.virtualbox.org/viewtopic.php?t=2019">here</a>), and then did the following:

<div class="wp-terminal">user@computer:$ sudo apt-get install mbr<br/></div>


<div class="wp-terminal">user@computer:$ install-mbr -e12 --force ~/vm.mbr<br/></div>

<p>The <strong>-e12</strong> argument means I want the first and second partition enabled in the MBR.  This is critical to getting it all to work &#8211; otherwise the VM won&#8217;t know which partition to enable.</li>
<li>Now we are ready to actually create the raw disk for VirtualBox to handle, I typed in the following:

<div class="wp-terminal">user@computer:$ VBoxManage internalcommands createrawvmdk -filename /home/rajat/win7.vmdk -rawdisk /dev/sda -partitions 1,2 -mbr /home/rajat/vm.mbr -relative -register<br/></div>

</li>
<li>Go through VirtualBox, create a new VM, mark it Windows 7 (in my case 64-bit) and save.  The VM is ready to be started, but it won&#8217;t work entirely yet.</li>
<li>Set the VM to mount the DVD drive and put in your Vista DVD.  <strong>Start the VM</strong>.  Press <strong>F12</strong> and select the DVD drive to start (c).  Let Win7 setup start, pick a language, and then click the &#8216;Repair installation&#8217; option. Go through automatic repair, and then let the VM restart.  This time it should go into Win7 running off the raw disk.</li>
</ol>
<p>Let me know if you have any trouble with these instructions, or would like to add to them.  Drop me a line to know if these worked for you as well.  I can&#8217;t wait to use these steps on my other boxes and put Windows in a box while I&#8217;m using it.</p>
<p><em><strong>Update: </strong>There is a regression in VirtualBox 3.10 regarding raw disk access.  Any machine that boots with raw disk access stops booting using VirtualBox 3.10.  Read more about it in the <a href="http://www.virtualbox.org/ticket/5355">documented bug report</a>.  As a workaround simply downgrade to VirtuablBox 3.08 or install the OSE edition.  I got hit with this the day after this post went live, downgrading solved the problem for me.</em></p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/7a413998-4608-4a12-af5e-46067ec84e3b/"><img class="zemanta-pixie-img" style="border: medium none ; float: right;" src="http://img.zemanta.com/reblog_c.png?x-id=7a413998-4608-4a12-af5e-46067ec84e3b" alt="Reblog this post [with Zemanta]"/></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.rajatarya.com/website/taming-windows-virtualbox-vm/feed</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.460 seconds -->

