Boot to VHD with the SharePoint Information Worker VHD (For those with 4GB of RAM or less)

6 03 2010

Before I begin I want to say thank you to a few people who helped me to get this working, through their blog posts and messages on twitter – @brianlala @joeloleson @LoungeFlyZ.

As I’m sure most of you are aware – the launch date for SharePoint 2010 has now been announced as May 12th. So what better time to start looking at SharePoint 2010.

Brian has already posted a guide on his blog that details most of the steps required to get this working –

http://spinsiders.com/brianlala/2010/02/03/high-level-steps-to-sp2010-demo-vhd-boot-joy/

I will cover some additional steps that aren’t mention and also what’s required to shrink the VHD and convert it to a fixed size. Whilst the VHD itself is only around 40gb in size – it has been set to dynamically expand and the OS partition is set at 130gb. This means that to boot from it you will need at least 130gb free on your hard drive as when the VHD is booted for some reason it needs to expand to its full size, see this post for more info –

http://codebetter.com/blogs/howard.dierking/archive/2009/08/08/windows-7-boot-from-vhd-a-few-gotchas.aspx

If you do not resize the VHD and don’t have the required space for it to expand then you will get a Blue Screen of Death (BSOD) when booting.

I will also cover in this guide the process of injecting your hard disk controller driver into the VHD. Brian covers this in his guide but I have some tips for this which I will share.

For those of you that weren’t aware, Microsoft have provided a SharePoint 2010 VHD for download entitled the ‘SharePoint Information Worker VHD’. This download actually contains two VHD’s – the second of which acts as as a mail server (this one will not be covered in this guide).

The first VHD contains SharePoint 2010 Beta, Visual Studio 2010 Beta, Office 2010 ‘Mondo’ and most apps you will need. The machine is setup as a domain controller of the ‘Contoso’ domain and is pre-populated with about 200 or so AD users. Various SharePoint sites have already been setup too.

Whilst I think the VHD’s provided by Microsoft are great they are not setup to be booted from. I only have 4gb of RAM in my laptop so boot to VHD was really the only option if I wanted to run this machine.

Part 1 – Resizing/Cloning the VM

1. Un-install Office 2010 ‘Mondo’ from the machine, if you don’t do this you will not be able to remove it again and will most likely be stuck with a 1722 error each time you launch an office application.

2. Follow the steps on Brian’s blog post to upgrade the OS within the VHD to Windows Server 2008 R2. You will need run the domainprep tool with the /forestprep and /adprep command line switches first.

3. Now you need to resize the 130gb partition to something more manageable. So download a copy of the GParted live CD and boot from it. Once you are at the GParted interface select the partition and resize it down to a sensible size – I chose 60gb. You will need to click resize and then apply.

4. Once GParted has finished – reboot the VM and let the chkdsk run if it wants to check the consistency of the disk. If you have a look in disk management now you will see that the partition has been resized but we are now left with a lot of unallocated space – this needs to be removed before we can boot to the VHD.

5. Shutdown the VM and create a new fixed size virtual hard disk, you will need to make sure it is slightly bigger than the size you chose earlier when resizing the partition. I chose 63gb for the size of my new virtual disk.

6. Attach the newly created hard disk file to the VM.

7. Now we need to clone the contents of the original hard disk onto the newly created one. There are a number of software options out there to do this – one in particular being Norton Ghost but this costs money. I found that Clonezilla which is free and open source does the job perfectly – http://clonezilla.org/. Download the live CD and boot the VM from it.

8. Follow the steps in the Clonezilla interface using beginner mode to clone the contents of hard disk 1 to hard disk 2.

9. Once Clonezilla has finished power off the VM and remove the original hard disk.

10. Power on the VM and make sure it boots correctly, if it fails check the troubleshooting section at the bottom of this post.

Part 2 – Configuring it to Boot

Before we can copy the virtual hard disk (VHD) file over to our client machine ready for booting we need to either inject the hard disk controller drives and modify the registry. If we don’t do this then we will most likely get a BSOD when we try to boot from the VHD.

I’m afraid that I am not going to go into a great level of detail here but will point out the steps that helped me and allowed me to get the VHD to boot.

1. Open the registry editor on the client machine (the machine you want to boot the VHD from) and navigate to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > services. This key contains all the drivers/services that windows loads when it boots.

2. Navigate to the same key on the VM, what you will need to do now is go through each of the sub-keys in the services key and compare each one’s ‘Start’ value. A value of 3 indicates that it will start when windows is boot and 0 indicates that it will not . Rather than go through each key, check ones which are most likely to be hard disk controllers e.g. ‘atapi,intelide’ etc.

Depending on your SATA/IDE controller it may not just be a case of editing these registry entries – you might need to copy the drivers to the VM and add registry entries for these drivers but I’m afraid I’m not going to cover that here.

3. THIS IS WHAT WORKED FOR ME – In my case I simply set the start value of the ‘msahci’ (SCSI Controller) to 0, this was set to start on the VM and I guess most likely because of the hardware that Hyper-V uses. Try this before attempting the above.

**Please note that once you have made these changes the VHD might not boot again in Hyper-V so you may wish to make a backup!**

Part 3 – Booting from the VHD

Once you think you are ready to boot from the VHD, copy the VHD file to your client machine and add an entry to the boot menu as described here –

http://technet.microsoft.com/en-us/library/dd799299%28WS.10%29.aspx

When you reboot your machine you will see a new option in the boot menu to boot into your SharePoint Information Worker VHD. If all has gone well then it will boot and you can then begin to install the drivers for your hardware.

Hope this helps someone – think this has been my longest blog post yet!! 🙂

**Troubleshooting

If for any reason the VM does not boot and you get this error message –

‘The boot selection failed because a required device is inaccessible’

Try these steps to fix it (I received the error after using GParted to resize the disk) –

1.Boot from the Windows CD you used to upgrade the VM

2. Select the ‘Repair My Computer’ option

3. Open the command prompt and type ‘bootrec /scanos’ – hopefully you will see the windows install

4. Now type ‘bootrec /rebuildbcd’ and select the windows install – this will add it back to the BCD boot menu.

5. Reboot the VM – hopefully it works!





How to: Boot Windows Server 2008 R2 or Windows 7 from a VHD

17 02 2010

I have now done this multiple times and was recently requested to write a quick how to on my blog so here it is. Windows 7 and Windows Server 2008 R2 both support being booted and installed as a VHD (Virtual Hard Disk). Rather than being installed physically on the disk – the operating system is simply is stored as a VHD file on your hard drive.

**Please note you will need an existing normal installation of Windows 7 or Windows Server 2008 R2 on your computer for this to work!**

Follow the steps below to get up and running:

  1. Boot from the Windows 7 or Windows Server 2008 R2 DVD
  2. When the first installation dialog appears press SHIFT + F10 to open the command prompt
  3. Type ‘diskpart’ and hit ENTER
  4. When the diskpart prompt appears enter the following command – create vdisk file=c:\vdiskname.vhd type=fixed maximum=20000 (this will create a VHD that is 20 GB in size on your C: drive). Make sure you change ‘vdisknamne’ to whatever you want to the VHD to be called. You can also use type ‘expandable’ instead of fixed if you wish so that the VHD expands automatically.
  5. Next type select vdisk file=c:\vdiskname.vhd – where ‘vdiskname’ is the name of your VHD
  6. Finally type attach vdisk
  7. Exit from diskpart and the command prompt
  8. Continue with the installation – when it comes to selecting the partition on which to install the operating system select the newly created VHD partition. Ignore any warnings like ‘you cannot boot from this partition’ as it will boot fine.
  9. Success – once the installation is finished and you reboot your PC you will see a new option in your boot menu to boot from your new VHD.

Hope this helps :-)!