Cloning Hyper-V Virtual Machines the Right Way – Windows Server 2012 R2


Cloning of Virtual Machine using Hyper-V is not a one step process, but still nevertheless it’s easy as the following numbered list. But why this is required is something which is not explained in all the sites.

  1. Create a VM with intended Windows in Hyper-V
  2. Update the Windows VM
  3. Sysprep the Windows VM

Fortunately, I found an article series which explains the process as well as what goes behind the scenes. Even though the articles is targeted towards Windows Server 2003 and 2008, I found the article to be 100% relevant for Windows Server 2012 R2 as well.

The article is a 4 part article which you can check below.

Cloning Hyper-V Virtual Machines the Right Way (Part 1)

Cloning Hyper-V Virtual Machines the Right Way (Part 2)

Cloning Hyper-V Virtual Machines the Right Way (Part 3)

Cloning Hyper-V Virtual Machines the Right Way (Part 4)

Thanks to Brien M. Posey for writing this article.Thanks

 

Windows 8 Pro’s Boot-to-VHD is a good news for an indie SharePoint developer !

SharePoint & Windows

SharePoint & Windows

A post describing SharePoint’s high resource usage and how Windows 8’s Boot to VHD will help to run SharePoint host with more dedicated resource.

Trailer….

For people like me who has to depend on resource hungry SharePoint servers, life is difficult as a developer and IT designer.

Most of the time we have to run the server inside a virtual environment and most of the time it would be a standalone server.

The problem….

Initially with SharePoint 2010 you could get away with at-least 6GB RAM allocated to a guest OS. But with SharePoint 2013 you require at least 12GB for a better experience and most of the machines come with 8GB or 16 GB RAM.

The problem is, your host OS will take at least 2GB RAM which for SharePoint can make life and death kind of experience even though Windows is perfectly capable of keeping SharePoint alive with paging (Virtual RAM) and have the storage drive on a never ending marathon run !

For virtual environment, the following are the options we generally have.

  • Microsoft Virtual PC (Free)
  • VMWare Workstation (Costly)
  • Oracle Virtualbox (Free)
  • Windows Server 2008/2012 R2’s Hyper-V (Super Costly)

Out of these, VirtualPC and Hyper-V natively use VHD container format for guest OS. Others too have these (Thanks to Microsoft’s Open Specification Promise) but mostly they use proprietary format.
When Windows 7 was rolled out, the Enterprise & Ultimate editions had the native Boot-to-VHD support.

What is Boot To VHD ?
Refers to the ability of a physical computer to mount and boot from an operating system contained within a VHD – (PS: Shamelessly copied the text from wikipedia)

Again to the problem….
Consider a scenario where you own a VM host system with 8GB RAM and run a VM guest with 6GB RAM for SharePoint 2010. This worked mostly fine. Then comes the SharePoint 2013 which requires even more ram, at-least 2GB in addition. Now you are in soup, you can wait forever to see the guest OS, aka Windows Server 2008 R2 or Windows Server 2012’s desktop to show up!

Solution….
Gain as much RAM as possible from host or upgrade the system to have more RAM. You will be in luck for desktop systems. Laptops, you are mostly in trouble.

Windows 7…..
Luckily with Windows 7(Enterprise/Ultimate) you could boot physical computer to a VHD and utilize all the resources. That’s good news, now you have all the RAM available for the SharePoint. The bad news is Enterprise is available for volume licensing only and Ultimate prohibitively costly.

Windows 8…..(forget Windows 8 RT, that thing can’t even run a standalone app!, but still a good OS for daily basic usage, so Microsoft is forgiven!)
Then comes Windows 8 with even more simpler editions. A regular version, professional version & an enterprise version. Compared to Windows 7, Windows 8 Pro is affordable and can be bought by an individual.
The best news is, Windows 8 Pro comes with Client Hyper-V and supports Boot To VHD.

So now as an indie SharePoint developer, you have a host OS which can be bought, has a virtualization capability and supports Boot To VHD.

Assuming you bought the host OS, i.e. Windows 8 Pro, its time to utilize it for better SharePoint development experience.
PS: I am going to explain only Boot-to-VHD part. Enabling Hyper-V in Window 8 Pro or installing SharePoint are out of scope for this post. Get help from trusted friend Google’s Search or Microsoft’s Bing.

After a long story…Main Picture…..

Enabling boot-to-VHD…..

  1. Create a VM Guest using Hyper-V and make a note of the location where the VHD file is located.
  2. In VM Host, go to Control Panel, Administrative Tools, Computer Management. Go to Disk Management under Storage.




  1. In Action menu, click Attach VHD. Now you should have a volume with drive letter. Make a note of the drive letter. In this case it’s D:\



  1. Now launch a command prompt as administrator.
  2. Take a backup of current boot information by using the following command
bcdedit /export C:\bcdcurrentbackup

  1.  Now let’s add the VHD’s Windows to boot by using the following command (The drive letter we noted will be used here)
bcdboot D:\Windows

  1.  Reboot the machine and you should be able to see the multi boot screen.

  1. Choose the SharePoint’s guest OS to boot.

You can use bcdedit command to rename the description of the Windows in multi boot screen.

Removing boot-to-VHD…

  1. Open command prompt in admin mode
  1. As mentioned in point 5 above take a backup of the boot system file
  2. View list of current boot entries by typing the following
bcdedit



  1. Make a note of the guid in the entries. In this case it’s {4ff0aa40-b17f-11e3-beaa-bc5ff4cf029e}
  2. Delete the entry by typing the following command
bcdedit /delete {4ff0aa40-b17f-11e3-beaa-bc5ff4cf029e}