Adventures in Creating a 64-bit VHD to Boot Win Server 2008 R2 in Windows 7


Having played briefly with VHDs created by others, I figured this was a cakewalk. Survey say XXX. Actually, it is not all that difficult, there are just some pitfalls. This is a continuation of a previous post, or perhaps an update is a better word.

First, before starting, here is my system:

Dell M4400
T9600 dual core processor
4 GB RAM
Windows 7 Ultimate X64

My first thought, as mentioned in the last post, was to try to dual boot with the VHD created by Microsoft with Visual Studio 2010 and Team System already loaded. Unfortunately, as mentioned, they used Windows Server 2008 instead of Windows Server 2008 R2.

The rest of this article goes through the steps necessary to dual boot, with options. You will have to make sure virtualization is on in the BIOS prior to going forward. On my Dell computer, I simply go into setup (F12) at start and then choose BIOS setup. I then choose virtualize and check to set it on.

1. Create the Virtual Disk

You have a couple of options here: create with Virtual PC or Create using DISKPART.

A. Create With Virtual PC

To do this, you have to download Virtual PC from here. If you want to also use XP Mode on your computer, download both and install XP mode first. To create the disk, open Virtual PC, which now looks like this:

VirtualPCManager

You can see I have the VHD from Microsoft already loaded and I can run it in Virtual PC. Click Create Virtual Machine. This brings up the following wizard:

CreateVPC1 

I chose the name VS2010VPC and chose to store it at C:VHD. Click next. In the next screen, you assign memory. Make sure you give the VPC enough to run the programs you wish to run. I feel less than 1 GB (1024 MB) is too light. Since I have 4, I am giving it 2.

CreateVPC2

The final step is to create a disk. With the wizard, I can go to advanced options, but I don’t need to.

CreateVPC3 

After you click create, you have both a .vmc and a .vhd file created. You will need to click Create a virtual hard drive using advanced options if you wish to make a fixed disk, as the default is expandable.

B. Create Using DISKPART

This is the shorter route. Open up a command prompt and type in the following:

diskpart
create vdisk file={path} maximum={maxSize} type=[fixed|expandable]

Here is a screenshot showing the feedback:

CreateVPCWithDiskpart

NOTE: If you want to create a drive and install on boot up, you run the same commands as above. The only difference is finding the drive to install on. A fixed disk uses more space up front, but installs much quicker. Example: expandable 10 minutes 42 second, fixed 4 minutes 48 seconds. This is due to not having to expand the VHD.

2. Format and Assign the Virtual Hard Drive

I stick to DISKPART here as it is the easiest option. Here are the steps

diskpart
sel vdisk file={path}
attach vdisk
list disk – I skipped this step, as I knew the disk was disk 1; if you are unsure, check, as formatting your primary drive is nasty
sel disk 1
create part primary
sel part 1
format fs=ntfs quick
assign letter=x
exit

SetupForImageX

3. Installing Windows Server 2008 R2

There are a couple of options here as well.

A. Install with ImageX

If you are willing to download the AIK, you can use ImageX to install the image. Here is how:

  1. Download the Windows Server 2008 R2 media or get a Windows Server 2008 R2 DVD
  2. Copy <DVD drive Letter>:sourcesinstall.wim to your local drive

Now, if you are unsure of the WIM file, you should use ImageX to get Info. The command is ImageX /info {path to .wim file}. You need the index to install properly.

ImageXReview 

On a standard MSDN DVD for Windows Server the indexes are as follows:

  1. Standard
  2. Standard Core Only
  3. Enterprise
  4. Enterprise Core Only
  5. Data Center
  6. Data Center Core Only
  7. Web
  8. Web Core Only

To install Windows Server 2008 R2 Standard from a .wim file with ImageX, you first have to mount the drive. We did this in the last section when we assigned the letter X to the drive. After that, type the following:

imagex /apply {path to wim} {drive letter for drive}

Here is the screenshot:

ImageXInstall

When I finished, I had an install of x64 version of Windows Server 2008 R2 Standard.

B. Install from DVD in Virrtual PC

This does not work, as This version of Virtual PC won’t accept 64 bit installs for some reason. If you know a way around this, please comment.

VPC Fail

NOTE: You can start the 

C. Install from DVD at Boot

I will try to fill this one in later. This is mentioned on many sites, but there are some steps missing. You have to work with volumes to get this working, as you have to attach the VHD during boot. This is not mentioned on any site I have seen thus far, so it may only be an issue with a machine like mine.

4. Creating the Boot Menu

If you installed from DVD, you do not have to do this step, as your OS is already installed in the boot menu. If you used ImageX, you do have to do this.

Our first step is to copy the {current} profile with the following command:

bcdedit /copy {current} /d "Windows Server 2008 R2 VHD"

NOTE: I normally use {} to indicate something you need to change. In this case, {current} is an identifier.

We now need the GUID created with the new profile. To do this, we merely type in bcdedit. The GUID for my copy is {09e67600-f653-11de-85a1-91aca7ed0ebc}, but yours will vary. These 2 steps are contained here:

bcdeditStep1

If you have the drive assigned a letter still, you need to detach it before going forward. This is as simple as selecting and then detaching. Here are the commands:

diskpart
sel vdisk={path}
detach vdisk
exit

And here is a screen shot

DetachingVDISK

Then you fix the entry for Windows Server so it boots from the VHD. Here are the commands

bcdedit /set {guid} device vhd=[{drive}:]{path}
bcdedit /set {guid} osdevice vhd=[{drive}:]{path}
bcdedit /set {guid} detecthal on

And here is a screenshot with specifics:

BCDEDIT_FIX

If you run the bcdedit command now, you will see something like this for the second boot loader

Windows Boot Loader
——————-
identifier              {09e67600-f653-11de-85a1-91aca7ed0ebc}
device                  vhd=[C:]vhdvs2010vpc.vhd
path                    Windowssystem32winload.exe
description             Windows Server 2008 R2 VHD
locale                  en-US
inherit                 {bootloadersettings}
recoverysequence        {09e675fc-f653-11de-85a1-91aca7ed0ebc}
recoveryenabled         Yes
osdevice                vhd=[C:]vhdvs2010vpc.vhd
systemroot              Windows
resumeobject            {09e675fa-f653-11de-85a1-91aca7ed0ebc}
nx                      OptIn
detecthal               Yes

This is a success.

When you first boot Windows Server 2008 R2, you will have additional steps to complete. Once you complete the steps, you should make a backup copy of the VHD so you can use it for other beta installs in the future.

Peace and Grace,
Greg

Twitter: @gbworld

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: