Wednesday, February 1, 2012

Windows 7 Ultimate - Virtual Hard Disk

Recently, I decided I needed to be smarter about building a more versatile virtual machine.  So I decided to go the route of creating a virtual hard disk (VHD).

With my main OS being Windows 7, I knew I had the ability to boot directly into a VHD.  Why?  Because this will allow the virtual to utilize my full system resources.

But what if I want to boot into my main OS?  Good news!  VHDs can be loaded by Virtual Box.  Meaning I can boot into my primary OS, and then use Virtual Box to launch a virtual machine (VM) into the VHD.

And there is even a third benefit.  Microsoft’s Hyper-V technology can take bootable VHDs and spawn VMs off.  Not only can I leverage the VHD locally (for those on-the-go and limited/weak network connectivity times), but teams could use it out of the cloud!

The first VHD I will create is an expandable Windows 7 (x64) Ultimate, 100GB baseline.  I will spell out my steps to creating it, making it accessible through Virtual Box, and finally direct booting into it.


The first part is to create a VHD.  I started by leveraging someone else’s blog: http://blog.tallan.com/2011/09/06/creating-a-bootable-vhd-that-can-also-be-run-from-a-virtual-machine/

The one deviation I made was creating an expandable VHD over a fixed one.  (Note: This is a baseline, I’m more worried about saving space over stealing a large chunk permanently away).  It was just a matter of adding the additional command line parameter type=expandable.


If you prefer other alternatives, Microsoft does have good resources for creating initial VHD files:  http://technet.microsoft.com/en-us/library/gg318052.aspx.

The blog goes on to talk about creating Server 2008, I’ll replicate many of the screen shots here for Windows 7 Ultimate.

* VM Name and OS Type

* Memory – The default is 512MB.  But with 8GB available, I decided to start with a “healthy” amount.

* Virtual Hard Disk

*** Virtual Machine Successfully Created ***

Now time to install the OS.

* Go into the settings of the new drive

* Choose Storage, and then select the CD drive.

* Find where you can setup the drive.  (Mine happens to be the disk image on the far right)

* Since I typically download ISOs, I have the ability to attach a virtual.  You can use your physical (Host) drive and insert a real disk.

*** Success!  We are now ready to install our OS ***

Since a billion people on the web have already documented how to install Windows 7, I’m just going to give you one link that you can follow: http://www.pcmag.com/article2/0,2817,2354687,00.asp

NOTE: I did run across the following error.
Failed to open a session for the virtual machine Windows 7 (x64) Ultimate.
VT-x features locked or unavailable in MSR. (VERR_VMX_MSR_LOCKED_OR_DISABLED).
Result Code:
E_FAIL (0x80004005)
Component:
Console
Interface:
IConsole {1968b7d3-e3bf-4ceb-99e0-cb7c913317bb}

And to solve, I went out and found the following help:


Now that I have this baseline VHD.  I think I’ll check out the SharePoint 2010 Easy Setup Script.  (See Chris Johnson’s blog entry for more details.)

I also liked reading the rest of the blog about using BCDEDIT to launch my machine directly into the VHD.




No comments:

Post a Comment