Category Archives: Hyper-V

Various topics covering Microsoft’s Hyper-V

VHD Liposuction–How to shrink a dynamic VHD file after reclaiming space

The Problem
You have a 250GB VHD Dynamic VHD file which has eaten too much of your Hyper-V host’s drive space (WSUS Instances come to mind).   You have accessed the virtual machine and deleted/removed the unwanted bloat that occurs over time.  But, you still can’t shrink the .VHD file on the host server.


The Solution

Simply deleting or otherwise removing files from your virtual machine’s drive does not allow the VHD to be shrunk.  You must “Zero Out” the unused sectors so Hyper-V can reclaim the space.

 

The How To

  1. Download Secure Delete from Microsoft onto the Virtual Machine
    http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx
    Important: Remember to unzip the file to an easy to access location.
  2. Open a Command Prompt
    Important: Remember to launch as Administrator!
  3. Execute SDelete as follows (where [path] is the located you unzipped the file)
    [PATH]sdelete –c -z
  4. Accept the terms and let it run
  5. Wait….
  6. Shutdown the virtual instance
  7. Launch Hyper-V Manager on the host server
  8. Open up the setting panel for the Hyper-V instance you wish to perform a VHD shrink for.
  9. Select the drive you wish to compact and click Edit
  10. Select Compact and click Finish
  11. Wait…

 

That is it!  Your done!

Creating Hyper-V virtual networks and the dreaded “Cannot bind to” error message

Windows 2008 R2 Hyper-V server is an incredible tool in the IT pro’s test, backup, and recovery arsenal…. as long as everything meshes together nicely.

One of the more interesting errors we see in the field is the dreaded message

Error Applying New Virtual Network Changes
Binding to the external ethernet [NIC goes here] failed.
Cannot bind to [NIC goes here] because it is already bound to another virtual network.

image

 

We at AIS see this problem most often when dealing with multiple-NIC servers.  The failure scenario goes something like this:

  1. Provision and configure Hyper-V server 2008 R2
  2. Access the new Hyper-V server via Hyper-V Manager on a separate PC
  3. Provision the first NIC under a virtual network
  4. Provision the second NIC under a virtual network (At this point, something goes awry in the Hyper-V Manager due to a variety of RPC / COM issues… the list of which would fill a small book)
  5. The second NIC provisioning is partially active within Hyper-V but is not accessible via the Hyper-V Manager
  6. Any additional attempts to provision the second NIC will now be met with the dreaded “is already bound to another virtual network” error

The quick and dirty solution

  1. Remote desktop into the Hyper-V server
  2. Find the command prompt window
    This is usually located behind the blue colored Server Configuration prompt window
  3. Type the following commands to uninstall and then reinstall the Microsoft Virtual Network Switch Protocols

C:> netcfg –u vms_pp

C:> netcfg –c p –i vms_pp

 

These two commands will 1st uninstall the virtual switch protocols and then force a reinstall of the same protocols.  This simple two step process forces the invalid virtual network mapping to be cleared from the configuration.

Happy (Virtual) Mappings!

Moving, Copying, and Linking Hyper-V files

The one function not currently well supported in Hyper-V is the movement and copying of VM and VHD files or virtual machines without using the Export / Import functionality.  While it is possible to manually move VHD files, the operation is tedious and complex.

At AIS, we have discovered the need for copying VHD files ranges from moving a large .VHD from a full hard drive to quickly supporting test bench copies from a gold disk image.  After the 10 or 12 manual updates of the VHD XML file, symbolic links, and security we decided it was time for a utility.

You can download and read the documentation from this link

The Windows .MSI installer is available for download via this link

image