Home » Posts tagged 'VHD'

Tag Archives: VHD

Getting Started With Hyper-V in Server 2012 and Windows 8

You all know by now that I am a huge Hyper-V fan… I have been using it since 2008, but with the latest release I am unabashedly loving Microsoft’s Layer 1 hypervisor.  The fact that it has been included in Windows 8  – as in, no different from the virtualization platform I use in my servers – is just the icing on the cake.

It is true that almost any IT Pro would be able to install and use Hyper-V on either the server or client platform without much guidance.  However when you do start out – either with Hyper-V in general, or on a new system – there are a few things that you should know before you go.  Here are some of my tips, in no particular order of importance.

1) Change the default file locations!

The default file locations for virtual hard disks and virtual machines are a bit obscure.  I like to change them right out of the gate.  Depending on which drive I want to store them on (in Windows 8 it is usually the C drive, while on proper servers it will usually not be) I will store them both right off the root… x:\VHDs and x:\VMs.  That way I do not have to navigate to the defaults whenever I want to copy a file.  I find x:\VHDs much easier than c:\Users\Public\Documents\Hyper-V\Virtual Hard Disks and c:\ProgramData\Microsoft\Windows\Hyper-V.

If I am going to use Failover Clustering with Cluster Shared Volumes the defaults will be different, but for standalone servers these defaults suit me fine.


  1. In Hyper-V Manager click on Hyper-V Settings… in the Actions Pane.
  2. Under the Server context, click on Virtual Hard Disks and change the default location.  You will have to create the directory before going ahead.
  3. Still under the Server context, click on Virtual Machines and change the default location.  Again, you will have to create the directory first.

It’s as easy as that.  Of course, VMs that are already there will not be moved, but going forward all VMs will be placed in the proper directory.

2) Create your Virtual Switch!

When you start creating virtual machines there will be nowhere for them to go and nobody for them to talk to… that is, unless you create a virtual switch (previously called virtual network) to connect them to.  Depending on your server and your environment this might be simple or complex, and may require more planning.  However the long and the short of it is you have to make three decisions when creating a virtual switch:

  • Is the network going to be External (can communicate beyond the physical host), Internal (can only communicate with other VMs on the same host, plus with the host), or Private (can only communicate with other VMs on the same host)?
  • If External, what physical NIC (uplink) will it be bound to?
  • Can the Management OS (on the host) use the same NIC?


  1. In the Action Pane of Hyper-V Manager click Virtual Switch Manager…
  2. In the navigation pane click New virtual switch
  3. In the right screen select External, Internal, or Private and click Create Virtual Switch
  4. In the Virtual Switch Properties window delete New Virtual Switch and name the switch something that you will understand (i.e.: CorpNet).
  5. Click OK to close the Virtual Switch Manager.

Again, this is all there is to it.  Plain and easy, no fuss, no muss.

3) Configure Dynamic Memory

When you create a virtual machine there are a few defaults that Hyper-V thinks is a good idea… which I don’t.  The main one that comes to mind is the Dynamic Memory option (per VM).  When you configure Dynamic Memory the defaults are going to be:

Startup RAM: 512 MB

Minimum RAM: 512 MB

Maximum RAM: 1048576 MB

Ok, for a lot of our virtual machines 512MB may be a fine minimum… but unless you are driving a BAWL (Big @$$ Work Load) server on the VM you will nearly never need a terabyte of RAM.  Granted it is nice that we have that ability, it is not going to be the norm.  On the other hand, not setting a realistic maximum would mean that if your VM were to place a huge memory demand – say, because of an unchecked memory leak or a compromised server, or even something as simple as an Exchange Server grabbing as much physical (ahem… virtual) RAM as it can – then this would necessarily be at the expense of contention resources, which would no longer be available to other virtual machines on the same host.

My recommended best practice is to pick minimums and maximums that are reasonable to you for each server (and those will be different from VM to VM, depending on the load expectations).  You will be able to tweak these up or down as needed, but the point is you will have reasonable limits.  For many of my servers I set limits such as these:

Startup RAM: 512 MB

Minimum RAM: 512 MB

Maximum RAM: 4096 MB

These settings allow the VM to consume up to 4 GB of RAM when needed and available, but no more than that.  If I discover the VM workload needs more then I will tweak it up incrementally.  I am not letting resources go to waste, and I am making sure that my VMs work within their means – i.e.: as efficiently as they can.


  1. imageWithin Hyper-V Manager click on the VM in question and then in the Action Pane (VM Name) click Settings…
  2. In the Navigation Pane click Memory
  3. In the Memory window change the Minimum and Maximum RAM as needed.
  4. Click OK.

4) …and Hard Disks!

By default the virtual hard disks that are created for us in the New Virtual Machine Wizard will be 127 GB.  But do they really need to be that big?  Actually, in a lot of cases they do.  In many cases they should be bigger.  Sometimes they should be smaller.  If you are creating your disks this way then you should right-size them in the wizard.

With that being said, the one question that the wizard does not ask you is ‘what type of disk would you like to create?’  In Server 2012 there are actually three questions that you should be asked that are only asked when creating your disks using the New Virtual Hard Disk Wizard:

a) Would you like to create a VHD file (with backward-compatibility, and limited to 2 TB in size) or a VHDX file (which adds resilience to consistency issues that might occur from power failures, and are limited to 64 TB in size but offer no backward compatibility)

b) Would you like the disk to be Fixed size (pre-provisioned storage), Dynamically expanding (storage on demand), or Differencing disk (associated with a parent-child relationship with another disk)?

c) Would you like to create the new VHD(X) file based on the contents of an attached physical drive?

The solution is to pre-create your VHD(X) files to spec, and then point to them from the New Virtual Machine Wizard.  While dynamically expanding disks are fine for labs and offer greater portability, I never recommend them in a production environment.  Also if you think you might need to port your VMs back to Server 2008 (or Windows 7) then VHD will be required.


    1. From the Hyper-V Manager console in the Actions Pane click New > Hard Disk…
    2. Go through the wizard and select the options you choose.
    3. From the New Virtual Machine Wizard click the radio button Use an existing virtual hard disk and point to the right file.
    4. Click Finish.


Alternately, you could select the radio Attach a virtual hard disk later and create your VMs, then create your VHD(X) files, and then attach them.  It seems like more work to me though…

5) …and CPUs!

There are a few new settings in the Processor tab of Hyper-V VMs than there used to be.  Not only can you set the number of virtual processors (to the lesser of either a maximum of 64, or the number of physical cores in your computer), but you can also set the VM reserve, the percent of total system resources, the VM limit, and the relative weight.  These are all set in the main screen of the Processor Settings page.

imageWhat a lot of people do not realize is that there are two subsections to the Processor tab: Compatibility and NUMA.  In order to access these you need to expand the + next to Processor in the navigation pane.

NUMA stands for Non-Uniform Memory Architecture, and essentially means that a single VM can use memory that is assigned to different physical CPUs.

Compatibility in this context refers to CPU families, and is a very handy option indeed.  In virtualization there is no way to live-migrate a VM from a host running on AMD CPUs to a host running on Intel CPUs.  This is not a limitation of Hyper-V, rather of the architecture of CPUs, and is identical in VMware.  However CPU family is not the only limiting factor to allow live migrations; CPU properties are a factor too, and because of advancements in the technology it would generally not be possible to live migrate a VM from a host with an older CPU to a host with a newer CPU.

A few years ago VMware saw this as an issue, and along with Intel developed a technology called EVC, or Enhanced vMotion Compatibility.  What EVC does is it masks the newer chipset features (generally multimedia signatures and things like that) from the VM, so that all of a sudden you can migrate between older and newer hosts (say, an Intel i7 to an Intel Core Duo).  In VMware this is assigned at the Cluster level.

Of course the technology is simple enough, but the intellectual property is not.  EVC has the word vMotion (a trademark) in the title.  Microsoft cannot use the term vMotion.  As such their compatibility mechanism (which works the same way) is called Migrate to a physical computer with a different processor version (MTPCWDPV).  The name is not nearly as sexy as EVC, but they compensated by assigning it to the VM instead of the cluster.  It is a simple checkbox that you check (or uncheck) under the Compatibility Configuration screen.

If you are going to be using Live Migration between hosts with potentially incompatible CPU then follow these steps:


      1. imageWithin Hyper-V Manager click on the VM in question and then in the Action Pane (VM Name) click Settings…
      2. In the Navigation Pane click Processor, then click the + next to Processor to expand the tree.
      3. Click on Compatibility
      4. Click the checkbox Migrate to a physical computer with a different processor version.
      5. Click OK.

Following these simple best practices will not make you an expert in Hyper-V by any means, but it is a good start… what they will allow you to do is get started comfortably and play with the technology without hitting some of the more common stumbling blocks that beginners seem to run into.  As your needs grow you will be comfortable enough with the technology to try new things, explore new possibilities.  Before long you will be as virtualization expert, ready to tackle concepts such as Shared Nothing Live Migration, Failover Clustering, Cluster Shared Volumes, and much much more.

In the meantime dip your toes into the virtualization waters… it’s warm and inviting, the hazards are not too dangerous, and the rewards are incredible.  In no time you will be ready to get certified… but even if that is not your goal you have already taken the first steps to becoming a virtual wiz!

When I’m Sixty-Four… TERABYTES!

Hard Disk Spindle

Hard Disk Spindle (Photo credit: Fr3d.org)

Okay, I am asking for a show of hands: How many of you remember 100MB hard drives? 80? 40?  While I remember smaller, my first hard drive was a 20 Megabyte Seagate drive.  Note that I didn’t say Gigabytes…

Way back then the term Terabyte might have been coined already as a very theoretical term, but in the mid-80s most of us did not even have hard drives – we were happy enough if we had dual floppy drives to run our programs AND store our data.  We never thought that we could ever fill a gigabyte of storage, but were happier with hard drives than with floppies because they were less fragile (especially with so many magnets about).

Now of course we are in a much more enlightened age, where most of us need hundreds of gigabytes, if not more.  With storage requirements growing exponentially, the 2TB drives that we used to think were beyond the needs of all but the largest companies are now available for consumers, and corporations are needing to put several of those massive drives into SAN arrays to support the ever-growing database servers.

As our enterprise requirements grow, so must the technologies that we rely on.  That is why we were so proud to announce the new VHDX file format, Microsoft’s next generation virtual hard drive files that has by far the largest capacity of any virtualization technology on the market – a whopping 64 Terabytes.

Since Microsoft made this announcement a few months ago several IT Pros have asked me ‘Why on earth would I ever need a single drive to be that big?’  A fair question, that reminds me of the old quote from Bill Gates who said that none of us would ever need more than 640KB of RAM in our computers.  The truth is big data is becoming the rule and not the exception.

Now let’s be clear… it may be a long time before you need 64TB on a single volume.  However rather than questioning the limit, let’s look at the previous limit – 2TB.  Most of us likely won’t need 64TB any time soon; however over the last couple of years I have come across several companies who did not think they could virtualize their database servers because of 2.2TB databases.

Earlier this week I got an e-mail from a customer asking for help with a virtual to physical migration.  Knowing who he reached out to, this was an obvious cry for help.

‘Mitch we have our database running on a virtual machine, and it is running great, but we are about to outgrow our 2TB limitation on the drive, and we have to migrate onto physical storage.  We simply don’t have any other choice.’

As a Technical Evangelist my job is to win hearts and minds, as well as educate people about new technologies (as well as new ways to use the existing technologies that they have already invested in).  So when I read this request I had several alternate solutions for them that would allow them to maintain their virtual machine while they burst through that 2TB ‘limit’.

  1. The new VHDX file format shatters the limit, as we said.  In an upcoming article I will explain how to convert your existing VHD files to VHDX.  The one caveat: if you are using Boot from VHD from a Windows 7 (or Server 2008 R2) base then the VHDX files are not supported.
  2. Storage Pools in Windows Server 2012 allow you to pool disks (physical or virtual) to create large drives.  They are easy to create and to add storage to on the fly.  I expect these will be among the most popular new features in Windows Server 2012.
  3. Software iSCSI Target is now a feature of Windows Server 2012, which means that not only can you create larger disks on the VM, you can also create large Storage Area Networks (SANs) on the host, adding VHDs as needed and giving access as BitLocker-encrypted Cluster Shared Volumes (CSVs), another new functionality of the new platform.
  4. New in Windows Server 2012, you can now create a virtual connection to a real Fibre Channel SAN LUN.  As large a volume as you can create on the SAN is your limit – in other words if you have the budget your limit would be petabytes!

With all of these options available to us, the sky truly is the limit for our virtualization environments… Whether you opt for a VHDX file, Storage Pool, Software- or Hardware-SAN, Hyper-V on Windows Server 2012 has you covered.  And if none of these are quite right for you, then migrating your servers into an Azure VM in the cloud offers yet more options for the dynamic environment, without the capital expenses required for on-premises solutions.

Knowing all of this, there really is no longer any reason to do a V2P migration, although of course there are tools that can do that.  There is also no longer a good reason to invest in third-party virtualization platforms that limit your virtual hard disks to 2TB.

Adaptable storage the way you want it… just one more reason to pick Windows Server 2012!

Windows 8 Experience Index… What it means and how to check it

SNAGHTML30c0a5cSix years ago Microsoft introduced the Windows Experience Index, a better way to measure the actual speed of computers, rather than simply relying on the single measurement of the CPU speed.

Although it really is more complicated than this, Microsoft has broken the speed of a computer down to five components: CPU, RAM, graphics and gaming graphics, and hard drive speed.  In Vista and then Windows 7 each of these was measured on a scale from 1.0-7.9.  In Windows 8 this has been changed to a scale from 1.0 to 9.9.

If you upgrade your computer from Windows 7 to Windows 8 then you will notice that your WEI has dropped; that’s because Microsoft realizes that newer hardware is available, and the hardware that was top of the line three years ago is now a bit longer in the tooth.

Each of the measurements has its own subscore, but the truth is that the speed of your computer is determined by the slowest of these – i.e.: the bottleneck.  So the Base Score of your computer – the one in the big blue square – is not a calculation or an average of the others, it is the lowest subscore from the five.

As you can see from the screenshot I took from my own laptop (an HP EliteBook 2740p) my Base Score is a 4.3.  As a business user I don’t see a particular need to invest in a machine with high-end graphics (especially pricy in laptops).  I don’t play games, and to watch the occasional movie all I need is a simple video card.  I am more concerned with the CPU, RAM, and hard drive performance in my system, and with these subscores at 6.8 and 7.7 I am very pleased with the laptop’s performance.

If you would like to check your Windows Experience Index, there are a couple of ways to do it:

  • Using the traditional method: In Windows Explorer right-click on Computer, click on Properties, and click on Windows Experience Index.
  • SNAGHTML32dfd04In the Windows 8 Start Screen type ‘experience’ (or enough of the word for it to be recognized.  Make sure you are in the Settings context, and click Use tools to improve performance.

From the Performance Information and Tools screen, click either Run the assessment or, if you have already run it previously, click Re-run the assessment.  Remember, it will not work if you are running on battery power… you will have to plug in your laptops to run it!  Also if you are running off a boot-from-VHD you can’t run it because the VHD performance interferes with the ability to measure the actual hard disk speed.

Windows 8 is faster than any operating system I have ever seen, even on legacy hardware.  However on newer hardware it is going to be incredible; the only issue with that right now is that you are going to have to wait until October 26th to buy it! Smile

Creating a Multi-OS Environment with Boot from VHD

Computers that contain this sticker met the re...

I spend a lot of time demonstrating different technologies for different audiences.  Because of that I often need to use different operating systems and rather than take along several machines (which I often have to do anyways, but for other reasons) I have taken to configuring my laptop (currently an HP EliteBook 2740p) in a multi-book configuration.  When I boot up I get a menu asking me which OS instance I want to boot, and I am off to the races!

Of course, this is easier said then done when some of the operating systems that I use and present change as often as they do – either because of things that I do (domain join, virtualization demos) or new versions (as is the case with the current Windows 8 and Windows Server 2012).  This problem is easily solved using the Boot from VHD (virtual hard disk) functionality in Windows 7 (and later).

Step 1: Preparing your host system

Although this is not strictly necessary, I like to partition my physical hard drive and place the VHDs on a separate partition from the operating system that is installed on the physical disk.  This is partially a legacy practice from when I would install all of my operating systems for the multi-boot scenario on the disk itself.  My current configuration has three partitions, one whose sole purpose is storing the OS VHDs.  However thinking about it logically, there is no good reason I can think of why you can’t simply store the VHDs on the C drive.

You need to have the source media for the operating system you plan to install, as well as the imagex.exe file, which is a component of the Windows Automated Installation Kit.  You can download this from download.microsoft.com, but make sure you download the version appropriate for the operating system and architecture on which you are installing it.

Because I often work with multiple images, I create a directory on my system called d:\VHDs, and in that folder I create a sub-folder for each image file.  So I may have the following directories:

  • d:\VHDs\Windows8RP
  • d:\VHDs\Windows2K8R2
  • d:\VHDs\Windows2012RC
      I prepare the media by copying the


      program into the


      folder, and then from the media of each OS I copy the


      file from the


      directory into the appropriate subdirectory.  The


    files are the actual image files of the operating system, and have been standardized since Server 2008 (and Vista).

Step 2: Creating a VHD

There are a couple of ways you can create VHD files within Windows.  I prefer to use the Disk Partition Tool (diskpart.exe) but if you want you can also use the Disk Management Tool within the GUI.

  1. In the Start Menu type cmd.exe and press <Enter>.
  2. In the command prompt window type diskpart.exe.  You should be prompted with a User Account Control window asking for confirmation. (If you are not an administrator you will be asked for credentials)  Click Yes.
  3. (Determine where you will store your virtual disk, and what you will name it.  for this example I will call it d:\VHDs\Svr2K8r2.vhd) Type create vdisk file=”d:\VHDs\Svr2K8r2.vhd” maximum=20480.  This will create a 20GB VHD file.
  4. Type select vdisk file=”d:\VHDs\Svr2K8r2.vhd”
  5. Type attach vdisk
  6. Type list disk.  You should now see a new 20GB disk (the line should have an asterix at the beginning).
  7. Type exit to quit the Disk Partition Tool.


    I created a 20GB VHD file, but you can size this to your needs.  Remember, you may also be installing applications, data, and other tools into your VHD file.  However size it to your needs and storage limitations.  The minimum should be no less than 9 for Windows 7, 10 for Windows Server 2008 R2.

Step 3: Apply the image to the VHD file

Now that our VHD file is attached to the computer, it is visible in Disk Manager.  Load that up (right-click on Computer, click Manage, and in the navigation pane click Disk Management) and initialize the disk, and then create a simple volume.  Take note of the drive letter that is assigned to it.  For the sake of the later step, let’s say the letter F: was assigned.

We can now apply the image using the ImageX tool.

  1. In the command prompt navigate to the d:\VHDs folder.
  2. Because .wim files can contain multiple builds of an OS (such as Windows 7 Ultimate, Professional, and Home Premium) we have to determine which one we will deploy by specifying the index that corresponds to the proper edition.  Use the following command to check the Index value of the operating system you want to build: imagex /info d:\vhds\Windows2k8R2\install.wim.  This will display all of the editions within the .wim file.  If you have a .wim file containing several builds you may want to add the switch |more onto the end so that it will allow you to scroll.
  3. In this case I want to build a VHD with Windows Server 2008 R2 Datacenter Edition (Full install), which might be Index 4.  I will type the following command: imagex /apply d:\VHDs\Windows2k8r2\install.wim 4 F:\ (Here the source media file is d:\vhds\Windows2k8r2\install.wim, and the drive letter assigned to the VHD is F:).

Step 3 will take a few minutes, but when it is done you can list the files and see that it resembles a bootable Windows 2008 R2 hard drive.  The problem is that most hardware will not recognize a VHD file as a boot device, so we need to edit the boot configuration data file, or BCD. 

Step 4: Editing your Boot Configuration Devices (BCD) file

Although this can be done from the command line (using bcdedit.exe) it is a bit of a pain.  there is a free (for personal use only) GUI tool called EasyBCD 2.1.2 which can do it for you. 

  1. Download BCDEdit 2.1.2 from SNAGHTML160d484www.neosmart.com.  Install the program and run it.
  2. Accept the EULA.  Please note that if you are using this for your work then you must buy the paid version.
  3. From the menu on the left select Add New Entry
  4. In the lower half of the window there is the option to add a Portable/External Media entry to the BCD list.  Ensure that Microsoft VHD is selected in the Type box.
  5. In the name box type the name that you want to appear in the boot menu (such as Microsoft Windows Server 2008 R2 Datacenter Edition (VHD).
  6. In the path box browse to the location of your VHD file (d:\VHDs\Svr2k8r2.vhd).
  7. Click Add Entry.

You are done!  All ready to go.

For Bonus Points!

  • Within EasyBCD you can click on the Edit Boot Menu option on the left, and choose which OS you want to be your default, and your timeout delay… but you have done it!  You are ready to restart into either operating system!
  • If you want to be able to revert your VHD configuration to this moment all you have to do is copy the VHD file to an alternate location.  If you ever hork things up all you have to do is copy over the original and poof, you are clean!
  • If you want to get fancy you can add several bootable VHDs to this menu… just follow the same steps!

That’s it.  The multi-boot option gets fancier in Windows 8, and I will cover that in a later article.  For now, as you know I always look forward to your comments and thoughts, and who knows… I might even give away the occasional prize for a good comment!

%d bloggers like this: