Archive for the ‘Hyper-V’ Category

Hyper-V Memory   Leave a comment

With Hyper-V’s “knobless” design, the biggest thing you have to remember about managing Hyper-V’s memory is to not try to assign more to virtual machines than you actually have available in your host. That’s not to say that you can’t find some room for tweaking.

Single Role

The first rule about Hyper-V is to not install anything inside the parent partition that isn’t directly related to Hyper-V or the hardware it lives on. Part of that is for security, but for the purpose of this discussion, it’s about resource contention. Any applications within the parent partition have to share resources with Hyper-V and all the guest machines. As a general rule, that contention is on equal footing; Hyper-V can’t prioritize itself over other applications operating at the same level. Make absolutely certain that everything in the parent partition is absolutely essential.

Design Virtual Machines

Spend some time in the design phase of your virtual machines thinking about how your Hyper-V memory is to be allocated. Memory is not to be wasted under any circumstances. Microsoft Exchange and most editions of Microsoft SQL are going to use up as much RAM as you assign to their virtual machines, so follow sizing guidelines for those applications to ensure that you are not allocating more than is actually needed for your projected workload.

Dynamic Memory

Microsoft introduced “Dynamic Memory” with Service Pack 1 for Hyper-v R2. This technology works by only assigning a minimum amount (that you specify) of RAM to a virtual machine at startup. Working through the Hyper-V Integration Services, a Windows virtual machine that supports hot add memory can dynamically request and release RAM as its needs fluctuate. Hyper-V is the arbiter of how these requests are granted or denied. You can adjust the properties on individual virtual machines to increase or decrease their weighting in case more RAM is being requested than is available.

Only recent Windows guests can use Dynamic Memory. Linux, Windows XP, and other guests that cannot communicate with the Hyper-V Integration Services’ hot-add driver will never use more memory than is set as the minimum. However, because Hyper-V does not validate that the guest system is hot add capable, it will at least attempt to set aside any specified buffer amount, causing that RAM to be completely wasted.

As previously mentioned, Exchange and SQL will generally just gobble up whatever they can, which makes dynamic memory sort of pointless. Editions of SQL that don’t support h0t add memory won’t be able to allocate anything beyond whatever the startup RAM is, and that bar is unfortunately high. In SQL 2005 through 2008 R2, Express and Standard Editions couldn’t use hot add memory. In SQL 2012, this capability has been granted to the Standard Edition as well, but still not to Express. You will definitely need to manually size these installations.

As a general rule, I do not employ Dynamic Memory. I spend the time to size each virtual machine. For those that might have fluctuating workloads that can justify using Dynamic Memory, I am careful to spend time setting their memory prioritization.

Hyper-V Memory Prioritization

You can use Hyper-V Manager to set weights on how memory is allocated to individual virtual machines. Look on the Hyper-V memory tab of a virtual machine’s properties. By default, they are all given equal weighting. If you aren’t using Dynamic Memory, the weighting only applies when virtual machines start up. If there is insufficient available memory to start a particular virtual machine, it is simply left off. If you are using Dynamic Memory, memory is allocated in your preset priority order from high to low. If all machines are the same priority, Hyper-V decides.

Basic Mechanics of Hyper-V Memory Utilization

Hyper-V does not “overcommit” or “thin provision” memory. Whatever RAM a virtual machine is reporting that it has access to is actually allocated to that machine and you cannot instruct Hyper-V to assign a greater total of RAM to virtual machines than you actually have available. Hyper-V will never page the RAM of its guest machines. In Hyper-V R2, this opens the door for some tweaking of the way the parent partition utilizes its page file; we produced an article outlining how to modify this. In Hyper-V 2012, the default page file configuration is much more suitable to the Hyper-V role and doesn’t really need any modifications.

If you want to see how memory is being utilized by Hyper-V itself, including how it has allocated memory to virtual machines, you’ll need a third-party tool. Task Manager won’t do it. This is because what you actually have access to is a parent partition, not the actual hypervisor itself. Task Manager won’t have access to anything other than what’s inside the parent partition, and that is nothing more than a special-case virtual machine that operates at the same level as any other virtual machine. Hyper-V Manager can show you how much memory is currently allocated to individual virtual machines, but doesn’t have any sort of totalling system. System Center Virtual Machine Manager can show you how much memory the host has available.

Memory Changes in Hyper-V 2012

The biggest news is the addition of “Smart Paging”. This is a pseudo-overcommit technology in which Hyper-V will temporarily page RAM for virtual machines under specific circumstances. Aidan Finn has already written a great summary of this technology. While reading that post, also take note of the change to the way .BIN files are handled in Hyper-V 2012. This addresses an annoyance to many Hyper-V R2 administrators who didn’t expect to lose those extra few gigabytes of storage space.


Posted 18/10/2012 by Petri in Hyper-V

Howto copy files to your Guest Microsoft Hyper-V   Leave a comment

Powershell and Hyper-V go hand in hand, learn more about an easy way to create a VHD file and connect it to your virtual machine in this blog.

Where I came from

A few weeks ago I decided to start with Microsoft Windows 8, the world is changing and I thought I better change along. With Microsoft Windows 8 comes Hyper-V, Microsoft answer to VMware ESX/vSphere.

Sharing folders

With Microsoft Windows 7  I ran VMware Workstation and I used to share several folders on my laptop to share ISO or common installation files with the virtual machines. It’s handy when you play around with new stuff and have to install virtual machine regulary. You don’t have to download the same stuff over and over, it’s easier to have DotNet stuff and stuff like that easy accesible for your virtual machine.


I was kinda shocked to find out that Microsoft Hyper-V for Windows 8 lacked this kind of option, to share folders to a guest virtual machine. To people using Microsoft Hyper-V on Windows 8 for a longer time it might not have been a suprise but to me, using VMware products since like ever it was a suprise. Of course the Windows 8 version of Hyper-V is nothing compared to the server version, but then again VMware also has a client version and a server version of it hypervisor. So here I’m talking about the client version, with VMware it’s Workstation and with Hyper-V, it’s Hyper-V for Windows 8.
In the menu you can find a way to copy clipboard text to the machine, another feature not so greatly implemented. The clipboard option is to be found under the clipboard menu.
You can connect a ISO file to the guest virtual machine, this will be used mostely when you have to install a certain product. Connecting a ISO file is done in the Media/DVDDrive option from the menubar

Getting data

So the first thing I needed to figure out is how do I get data to my guest virtual machine when I can’t connect my guest to the network. I have some virtual machine that run DNS/DHCP and other services I don’t want to expose to outside networks. I usually create a internal VLAN’d network where my servers run freely without the chance of interrupting any network services  at the office or at customers.
So I still was stuck with getting the data, no way Hyper-V let me get my data.
After a few hours of frustration I decided to create an ISO of the folder I use mostly for standard software. This ISO I connected to the guest virtual machine and I was able to finish my work.

ISO Emulator

Still this didn’t satisfy me, I didn’t see myself creating an ISO everytime I needed a file… that’s not gonna work. I went to search  on the Internet for a solution to have an ISO but not having to create one every time you want to add files. I was looking for a dynamical ISO or like @AndrewCooke said on Twitter a “Writeable ISO emulator”.@PeterNoorderijk pointed out, as you can read in the comments, that we live in the VHD/PowerShell era. He’s right of course about that, these days it would be more logical to add a VHD to a guest virtual machine containing the data you need. 

How would this work?

With an ISO emulator you would assign a folder to be read by a service, that service would provide an virtaul ISO file to the guest virtual machine. The virtual machine read the ISO as is and will handle it like a normal ISO file. Everytime you add or delete files from the folder you would see the difference when you refresh your drive content in the virtual machine.

VHD and Powershell

I wanted to see how easy it is to create a VHD, copy data on it and connect it to the guest virtual machine. I could have done that manually but I perfer to use Powershell for this.

Create a VHD

With Microsoft Windows 8 it logical to use VHD for the disks are in VHD format. So (inspired by @PeterNoorderijk his comment) I created a VHD, copied files to it and attached it to the guest virtual machine.
Creating a VHD with Powershell is easy, so I started of with creating a 20GB VHD file.

The VHD file is created in the C:\VM folder on my local harddisk, as you can see below.

The VHD file is not mounted automatically and therefore not visible as a drive at this moment.

To copy data to the VHD file you need to mount it…but again PowerShell comes to the rescue.

After we mounted the disk we  have to initialize it..So let’s see which disks we have

So it turn out we have to initialize Disk 1. To initialize the disk, type the command as shown above “Initialize-Disk 1 -PartitionStyle MBR” .
Next job is to create a partition so that we can drop some data on the disk.

The last job is to format the volume.
The Format process is shown in your PS screen.

Of course this could be written in a more fashionable way by a real scripter but the proces is the same.
the disk is ready now and we can drop data on it..
After you copied the data to the disk you can dismount it… with PowerShell of course.

The disk is not visible anymore in Explorer.
Now we can connect it to the Guest in Hyper-V..again with Powershell.

If we look at the settings of the virtual machine we see this VHD is added.

This could be made as a script to connect/disconnect the file and make data available to virtual machines.

Posted 17/10/2012 by Petri in Hyper-V

Windows Server 2012 Hyper-V Replica   Leave a comment

If you asked me to pick the killer feature of WS2012 Hyper-V, then Replica would be high if not at the top of my list (64 TB VHDX is right up there in the competition). In Ireland, and we’re probably not all that different from everywhere else, the majority of companies are in the small/medium enterprise (SME) space and the vast majority of my customers work exclusively in this space. I’ve seen how DR is a challenge to enterprises and to the SMEs alike. It is expensive and it is difficult. Those are challenges an enterprise can overcome by spending, but that’s not the case for the SME.

Virtualisation should help. Hardware consolidation reduces the cost, but the cost of replication is still there. SAN’s often need licenses to replicate. SAN’s are normally outside of the reach of the SME and even the corporate regional/branch office. Software replication which is aimed at this space is not cheap either, and to be honest, some of them are more risky than the threat of disaster. And let’s not forget the bandwidth that these two types of solution can require.

Isn’t DR Just An Enterprise Thing?

So if virtualisation mobility and the encapsulation of a machine as a bunch of files can help, what can be done to make DR replication a possibility for the SME?

Enter Replica (Hyper-V Replica), a built-in software based asynchronous replication mechanism that has been designed to solve these problems. This is what Microsoft envisioned for Replica:

  • If you need to replicate dozens or hundreds of VMs then you should be using a SAN and SAN replication. Replica is not for the medium/enterprise sites.
  • Smaller branch offices or regional offices that need to replicate to local or central (head office or HQ data centre) DR sites.
  • SME’s who want to replicate to another office.
  • Microsoft partners or hosting companies that want to offer a service where SME’s could configure important Windows Server 2012 Hyper-V host VMs to replicate to their data centre – basically a hosted DR service for SMEs. Requirements of this is that it must have Internet friendly authentication (not Kerberos) and it must be hardware independent, i.e. the production site storage can be nothing like the replica storage.
  • Most crucially of all: limited bandwidth. Replica is designed to be used on commercially available broadband without impacting normal email or browsing activity – Microsoft does also want to sell them Office 365, after all How much bandwidth will you need? How long is a piece of string? Your best bet is to measure how much change there is to your customers VMs every 5 minutes and that’ll give you an idea of what bandwidth you’ll need.

In short, Replica is designed and aimed at the ordinary business that makes up 95% of the market, and it’s designed to be easy to set up and invoke.

What Hyper-V Replica Is Not Intended To Do

I know some people are thinking of this next scenario, and the Hyper-V product group anticipated this too. Some people will look at Hyper-V Replica and see it as a way to provide an alternative to clustered Hyper-V hosts in a single site. Although Hyper-V Replica could do this, it is not intended for for this purpose.

The replication is designed for low bandwidth, high latency networks that the SME is likely to use in inter-site replication. As you’ll see later, there will be a delay between data being written on host/cluster A and being replicated to host/cluster B.

You can use Hyper-V Replica within a site for DR, but that’s all it is: DR. It is not a cluster where you fail stuff back and forth for maintenance windows – although you probably could shut down VMs for an hour before flipping over – maybe – but then it would be quicker to put them in a saved state on the original host, do the work, and reboot without failing over to the replica.

How It Works

I describe Hyper-V Replica as being a storage log based asynchronous disaster recovery replication mechanism. That’s all you need to know …

How Replication Works

Once Replica is enabled, the source host starts to maintain a HRL (Hyper-V Replica Log file) for the VHDs. Every 1 write by the VM = 1 write to VHD and 1 write to the HRL. Ideally, and this depends on bandwidth availability, this log file is replayed to the replica VHD on the replica host every 5 minutes. This is not configurable. Some people are going to see the VSS snapshot (more later) timings and get confused by this, but the HRL replay should happen every 5 minutes, no matter what.

The HRL replay mechanism is actually quite clever; it replays the log file in reverse order, and this allows it only to store the latest writes. In other words, it is asynchronous (able to deal with long distances and high latency by write in site A and later write in site B) and it replicates just the changes.

Note: I love stuff like this. Simple, but clever, techniques that simplify and improve otherwise complex tasks. I guess that’s why Microsoft allegedly ask job candidates why manhole covers are circular

As I said, replication or replay of the HRL will normally take place every 5 minutes. That means if a source site goes offline then you’ll lose anywhere from 1 second to nearly 10 minutes of data.

I did say “normally take place every 5 minutes”. Sometimes the bandwidth won’t be there. Hyper-V Replica can tolerate this. After 5 minutes, if the replay hasn’t happened then you get an alert. The HRL replay will have another 25 minutes (up to 30 completely including the 5) to complete before going into a failed state where human intervention will be required. This now means that with replication working, a business could lose between 1 second and nearly 1 hour of data.

Most organisations would actually be very happy with this. Novices to DR will proclaim that they want 0 data loss. OK; that is achievable with EUR100,000 SANs and dark fibre networks over short distances. Once the budget face smack has been dealt, Hyper-V Replica becomes very, very attractive.

That’s the Recovery Point Objective (RPO – amount of time/data lost) dealt with. What about the Recovery Time Objective (RTO – how long it takes to recover)? Hyper-V Replica does not have a heartbeat. There is not automatic failover. There’s a good reason for this. Replica is designed for commercially available broadband that is used by SMEs. This is often phone network based and these networks have brief outages. The last thing an SME needs is for their VMs to automatically come online in the DR site during one of these 10 minute outages. Enterprises avoid this split brain by using witness sites and an independent triangle of WAN connections. Fantastic, but well out of the reach of the SME. Therefore, Replica will require manual failover of VMs in the DR site, either by the SME’s employees or by a NOC engineer in the hosting company. You could simplify/orchestrate this using PowerShell or System Center Orchestrator. The RTO will be short but have implementation specific variables: how long does it take to start up your VMs and for their guest operating systems/applications to start? How long will it take for you to get your VDI/RDS session hosts (for remote access to applications) up, running and accepting user connections? I’d reckon this should be very quick, and much better with the 4-24 hours that many enterprises aim for. I’m chuckling as I type this; the Hyper-V group is giving SMEs a better DR solution than most of the Fortune 1000’s can realistically achieve with oodles of money to spend on networks and storage replication, regardless of virtualisation products.

A common question I expect: there is no Hyper-V integration component for Replica. This mechanism works at the storage level, where Hyper-V is intercepting and logging storage activity.

Replica and Hyper-V Clusters

Hyper-V Replica works with clusters. In fact you can do the following replications:

  • Standalone host to cluster
  • Cluster to cluster
  • Cluster to standalone host

The tricky thing is the configuration replication and smooth delegation of replication (even with Live Migration and failover) of HA VMs on a cluster. How can this be done? You can enable a HA role called a Hyper-V Replica Broker on a cluster (once only). This is where you can configure replication, authentication, etc, and the Broker replicates this data out to cluster nodes. Replica settings for VMs will travel with them, and the broker ensures smooth replication from that point on.

Configuring Hyper-V Replica

I don’t have my lab up and running yet, but there are already many step-by-step posts out there. I wanted to focus on the how it works and why to use it. But here are the fundamentals:

On the replica host/cluster, you need to enable Hyper-V Replica. Here you can control what hosts (or all) can replicate to this host/cluster. You can do things like have one storage path for all replicas, or creating individual policies based on source FQDN such as storage paths or enabling/pausing/disabling replication.

You do not need to enable Hyper-V Replica on the source host. Instead, you configure replication for each required VM. This includes things like:

  • Authentication: HTTP (Kerberos) within the AD forest, or HTTPS (destination provided SSL certificate) for inter-forest (or hosted) replication.
  • Select VHDs to replicate
  • Destination
  • Compressing data transfer: with a CPU cost for the source host.
  • Enable VSS once per hour: for apps requiring consistency – not normally required because of the logging nature of Replica and it does cause additional load on the source host
  • Configure the number of replicas to retain on the destination host/cluster: Hyper-V Replica will automatically retain X historical copies of a VM on the destination site. These are actually Hyper-V snapshots on the destination copy of the VM that are automatically created/merged (remember we have hot-merge of the AVHD in Windows 8) with the obvious cost of storage. There is some question here regarding application support of Hyper-V snapshots and this feature.

Initial Replication Method

I’ve worked in the online backup business before and know how difficult the first copy over the wire is. The SME may have small changes to replicate but might have TBs of data to copy on the first synchronisation. How do you get that data over the wire?

  • Over-the-wire copy: fine for a LAN, if you have lots of bandwidth to burn, or if you like being screamed at by the boss/customer. You can schedule this to start at a certain time.
  • Offline media: You can copy the source VMs to some offline media, and import it to the replica site. Please remember to encrypt this media in case it is stolen/lost (BitLocker-To-Go), and then erase (not format) it afterwards (DBAN). There might be scope for an R2/Windows 9 release to include this as part of a process wizard. I see this being the primary method that will be used. Be careful: there is no time out for this option. The HRL on the source site will grow and grow until the process is completed (at the destination site by importing the offline copy). You can delete the HRLs without losing data – it is not like a Hyper-V snapshot (checkpoint) AVHD.
  • Use a seed VM on the destination site: Be very very careful with this option. I really see it as being a great one for causing calls to MSFT product support. This is intended for when you can restore a copy of the VM in the DR site, and it will be used in a differencing mechanism where the differences will be merged to create the synch. This is not to be used with a template or similar VMs. It is meant to be used with a restored copy of the same VM with the same VM ID. You have been warned.

And that’s it. Check out the social media and you’ll see how easy people are saying Hyper-V Replica is to set up and use. All you need to do now is check out the status of Hyper-V Replica in the Hyper-V Management Console, Event Viewer (Hyper-V Replica log data using the Microsoft-Windows-Hyper-V-VMMS\Admin log), and maybe even monitor it when there’s an updated management pack for System Center Operations Manager.


I said earlier that failover is manual. There are two scenarios:

Planned: You are either testing the invocation process or the original site is running but unavailable. In this case, the VMs start in the DR site, there is guaranteed zero data loss, and the replication policy is reversed so that changes in the DR site are replicated to the now offline VMs in the primary site.

Unplanned: The primary site is assumed offline. The VMs start in the DR site and replication is not reversed. In fact, the policy is broken. To get back to the primary site, you will have to reconfigure replication.Can I Dispense With Backup?No, and I’m not saying that as the employee of a distributor that sells two competing backup products for this market. Replication is just that, replication. Even with the historical copies (Hyper-V snapshots) that can be retained on the destination site, we do not have a backup with any replication mechanism. You must still do a backup, as I previously blogged, and you should have offsite storage of the backup.Many will continue to do off-site storage of tapes or USB disks. If your disaster affects the area, e.g. a flood, then how exactly will that tape or USB disk get to your DR site if you need to restore data? I’d suggest you look at backup replication, such as what you can get from DPM:

The Big Question: How Much Bandwidth Do I Need?

Ah, if I knew the answer to that question for every implementation then I’d know many answers to many such questions and be a very rich man, travelling the world in First Class. But I am not.

There’s a sizing process that you will have to do. Remember that once the initial synchronisation is done, only changes are replayed across the wire. In fact, it’s only the final resultant changes of the last 5 minutes that are replayed. We can guestimate what this amount will be using approaches such as these:

  • Set up a proof of concept with a temporary Hyper-V host in the client site and monitor the link between the source and replica: There’s some cost to this but it will be very accurate if monitored over a typical week.
  • Do some work with incremental backups: Incremental backups, taken over a day, show how much change is done to a VM in a day.
  • Maybe use some differencing tool: but this could have negative impacts.

Some traps to watch out for on the bandwidth side:

  • Asynchronous broadband (ADSL): The customer claims to have an 8 Mbps line but in reality it is 7 Mbps down and 300kbps up. It’s the uplink that is the bottleneck because you are sending data up the wire. Most SME’s aren’t going to need all that much. My experience with online backup verifies that, especially if compression is turned on (will consume source host CPU).
  • How much bandwidth is actually available: monitor the customer’s line to tell how much of the bandwidth is being consumed or not by existing services. Just because they have a functional 500 kbps upload, it doesn’t mean that they aren’t already using it.

Very Useful Suggestion

Think about your servers for a moment. What’s the one file that has the most write activity? It is probably the paging file. Do you really want to replicate it from site A to site B, needlessly hammering the wire?

Hyper-V Replica works by intercepting writes to VHDs. It has no idea of what’s inside the files. You can’t just filter out the paging file. So the excellent suggestion from the Hyper-V product group is to place the paging file of each VM onto a different VHD, e.g. a SCSI attached D drive. Do not select this drive for replication. When the VMs are failed over, they’ll still function without the paging file, just not as well. You can always add one after if the disaster is sustained. The benefit is that you won’t needlessly replicate paging file changes from the primary site to the DR.

Posted 15/10/2012 by Petri in Hyper-V

Install Windows XP in Windows 8 Client Hyper-V   Leave a comment

As you may remember, Windows 7 came with Windows Virtual PC and Windows XP Mode allowing you to download and install a fully functional copy of Windows XP SP3 in a virtual machine running inside of Windows 7 Professional, Enterprise, and Ultimate. XP Mode was designed to ease migration and compatibility issues by allowing you to easily run Windows XP application in Windows 7.

The XP Mode for Windows Virtual PC included specialized integration components designed to allow applications installed in the Windows XP virtual machine to appear as if they were running directly in Windows 7 – the applications even appeared on the Windows 7 Start menu. When you launch such an application from the Start menu, the virtual Windows XP loads in the background without any UI and it looks and feels as though you are running the application directly in Windows 7. Microsoft calls this feature Seamless Mode.

As I explained in my last blog post, Create a test machine in Windows 8 Client Hyper-V, Microsoft has done away with Windows Virtual PC in favor of focusing on Hyper-V, which is a much more powerful and feature rich virtualization platform and also is the main virtualization platform in Windows Server. However, as a side effect of doing so, the XP Mode capability has also gone by the wayside.

Now, before you get all excited, losing XP Mode was not part of some evil plan by Microsoft to push folks away from Windows XP. In fact, the reason for the disappearance of XP Mode is related to the differences in the hypervisor platforms used by Windows Virtual PC and Windows 8’s Client Hyper-V. Windows Virtual PC uses Type-2 hypervisor while Hyper-V is a Type 0 hypervisor. The differences in Hyper-V’s hypervisor type means that it can’t provide the same access that made XP Mode’s integration feature possible.

However, that doesn’t mean that you can’t still run a Windows XP on a virtual machine in Windows 8. In this post, I’ll show you how to install Windows XP in Windows 8 Client Hyper-V virtual machine. As I do, I’ll show you some of the neat features in Client Hyper-V.

Launching Windows 8’s Client Hyper-V

To begin, just press the [Windows] key to bring up the Start Screen. Then, type Hyper and press [Enter] when Hyper-V Manager appears, as illustrated in Figure A.

Figure A

Accessing Windows Feature tool from the Start Screen is easy.

Creating the virtual machine

In last week’s article, I told you that there are two ways that you can create a virtual machine from the New Virtual Machine Wizard. You can work through the wizard to create a virtual machine or you can quickly create a virtual machine using the preconfigured default settings, which you can then change later. Since we worked through the wizard to create a virtual machine last time, we’ll create a virtual machine using the preconfigured default settings. We’ll then edit the virtual machine’s settings. While going this route is a bit more time consuming, it will allow us to take a look at some of the features available in the virtual machine Settings window.

After you launch the Hyper-V Manager, navigate to the Actions pane and select the New | Virtual Machine command. When the first screen of the New Virtual Machine Wizard appears, just click the Finish button, as shown in Figure B, to immediately create a virtual machine with preconfigured default settings.

Figure B

You can quickly create a virtual machine using the preconfigured default settings.

When you see the new virtual machine appear in the Virtual Machines list, right click the name and rename it to something like XP Virtual Machine, then go back to the Actions pane and click the Settings command, as shown in Figure C.

Figure C

Renaming the virtual machine will help you to keep track of it.

Editing the virtual machine’s settings

When the Settings window appears, you’ll see that there are a multitude of settings that you can configure to customize how your virtual machine will work. For the purposes of this article, I’ll just cover the basic settings that you need to get started with your Windows XP virtual machine.

Because Windows XP is an old operating system, it isn’t compatible with Hyper-V’s network adapter. As such, the first thing that you will need to do is add a legacy network adapter. Select the Legacy Network Adapter item, as shown in Figure D, and click the Add button.

Figure D

Because Windows XP is an old operating system, the first thing that you need to do is add a legacy network adapter.

When you do, Hyper V will add the Legacy Network Adapter to the Hardware list and immediately take you to that section. Since I already created a virtual switch for my last article, I’ll select the Test 1 Virtual switch from the virtual switch drop down, as shown in Figure E. Then, click Apply to save your changes. If you haven’t already set up a Virtual switch for the Network Adapter, you can do so at any time. (See my blog post, Create a test machine in Windows 8 Client Hyper-V.)

Figure E

If you have already configured a Virtual switch, just select it.

Now, move up the Hardware list and select the Memory section. I’m going to specify 1GB of RAM for my XP Virtual Machine. As you can see in Figure F, I’ve specified 1024 in the Startup RAM text box and left the Enable Dynamic Memory check box unselected. Even though the text box is titled Startup RAM, in the case of the Windows XP operating system, this will be the total amount of available RAM.

In other words, it will essentially be static memory. Being an older operating system, Windows XP is not supported by Hyper-V’s Dynamic Memory feature, so you’ll need to leave that check box unselected. The Memory Weight slider is designed to allow you to prioritize memory usage but it is related to the Dynamic Memory feature and so in the case of Windows XP we’ll just leave it as it is in the middle.

Figure F

Hyper-V doesn’t support Dynamic Memory for Windows XP.

To continue, go ahead and click Apply to save your settings. Then move down to the IDE Controller 0 | Hard Drive section.

When you arrive at the Hard Drive section, as shown in Figure G, the only thing that you may want to do is increase the size of the hard disk. By default, the hard disk is set to 127GB in size. For this example machine, I want to increase the size of the hard disk to 500GB. To do so, click Edit button.

Figure G

Chances are that you’ll want to expand the size of the virtual hard disk.

When the Edit Virtual Hard Disk Wizard appears, you’ll see that it immediately advances to the Choose Action page. You’ll then select the Expand option, click Next, and then specify the size as 500GB. These two steps are illustrated in Figure H. To complete the operation, click the Finish button. When you return to the Settings window, click Apply to save your changes.

Figure H

You’ll use the Edit Virtual Hard Disk Wizard to expand the size of the virtual hard disk.

Keep in mind that Hyper-V creates dynamically expanding virtual hard disks. This means that the hard disk only takes up as much room as needed and can only grow to the specified size. For example, clicking the Inspect button (next to the Edit button in the Hard Drive section) displays the Virtual Hard Disk Properties dialog box, shown in Figure I. As you can see, at this point the size of the virtual hard disk file is 4MB. As I install the operating system and applications, the virtual hard disk will grow in size until it reaches the maximum size of 500GB.

Figure I

The Virtual Hard Disk Properties dialog box shows the current size of the virtual hard disk.

At this point, move down to the IDE Controller 1 | DVD Drive section and choose how you want to install the operating system and applications on your virtual machine. You can use ISO images files or the physical CD/DVD drive. As shown in Figure J, I’ve selected the Physical CD/DVD drive option and indicated the appropriate drive letter. This will make it easy to install Windows XP from the optical disc. Click Apply to save your changes.

Figure J

You’ll specify how you want to configure the DVD Drive that you’ll use to install the operating system and applications on your virtual machine.

Launching the installation

Installing Windows XP in a Hyper-V virtual machine is easy. To begin, insert the Windows XP CD in the drive, go back to the Actions pane in the Hyper-V Manager, scroll down to the virtual machine section and click the Connect command. When you do, you’ll see a virtual machine window that tells you that the machine is turned off. At this point, just click the Start button on the menu bar, as shown in Figure K.

Figure K

Click the Start button on the virtual machine window’s toolbar.

You’ll then see the installation begin. Figure L shows the Windows XP Setup screen.

Figure L

Seeing the basic looking Windows XP Setup screen in Windows 8 is quite a stark picture.

Once the installation is complete, you’ll see the Windows XP desktop in a virtual machine in Windows 8, as shown in Figure M.

Figure M

Once the installation is complete, you’ll see the Windows XP desktop in a virtual machine in Windows 8.

Posted 12/10/2012 by Petri in Hyper-V

How To Convert VHD to VHDX with Hyper-V 3   Leave a comment

Windows Server 2012 and Windows 8 introduce a new virtual hard disk file format, VHDX, which is an upgrade from the current VHD format and provides for superior performance, reliability and several enhancements including:

  • Support for virtual hard disks larger than 2TB and up to 64TB.
  • Better performance of dynamic and difference files through new larger block sizes.
  • Improved alignment of the virtual hard disk on large sector disks.

Many of you already have a virtual infrastructure based on Microsoft Hyper-V and would need to upgrade all your existing VHDs in order to take advantage of all the new features and capabilities. Luckily, The Hyper-V team has taken that into consideration and provided a very simple way to convert existing VHDs into VHDX. Here’s how to do it:

  1. Launch Hyper-V manager and from the right side Action pane and select Edit Disk .
  2. The Edit Virtual Hard Disk Wizard starts; click Next to get past the initial screen.
  3. Enter the name and location of the existing VHD file (see Fig. 1) and click Next.

4. Select Convert and click Next.

5.Select the VHDX file format and click Next (see Fig. 2).

6. Complete the wizard by selecting the settings you need.

This process makes an exact copy of your existing VHD file, except now it’s in the new VHDX format. And should the need arise, you can always use the same process to convert from VHDX back to VHD.

Posted 11/10/2012 by Petri in Hyper-V

Create a Virtual Machine Based on an Exisiting VHD File Windows 8 Client Hyper-V   Leave a comment

Now that I’m running Windows 8, I want to use Hyper-V. I can’t import the virtual machines, but I can build new virtual machines from virtual disks. I have already converted the Virtual Box disk files from their format to VHD. But in order to test the entire process I’m going to use a copy of a VHD file previously created from another project.

The first thing I want to do, although not required, is to verify the VHD file. In Hyper-V Manager, there is an inspect disk action as I’ve highlighted below in Figure 1.

Windows 8 Hyper-V inspect disk

The action brings up a file browser. After navigating to the correct folder and selecting the VHD, I can see that it looks pretty good in Figure 2.

Windows 8 Hyper-V hard disk properties

No problems, so I’m going to build a new virtual machine around this disk. From the Actions pane I’ll click on New – Virtual Machine. This begins the wizard in Figure 3.

Windows 8 Hyper-V virtual machine wizard

Next, I’ll give my new VM a name. I’m going to accept the default location for now, as seen below in Figure 4.

Windows 8 Hyper-V virtual machine name

Clicking Next brings me to memory configuration. Because I intend to not have any other virtual machines running when this is running, I’ll go ahead and bump this to 4GB. My test machine has 8GB of RAM.

Windows 8 Hyper-V assign memory

Now it’s time to roll up my sleeves and do a little configuring networking. Remember, the VHD already has an installed instance of Windows Server 2012 RC, and I know it is configured for a single adapter. So I’ll create a new adapter with the virtual machine and bind it to my virtual switch that will connect it to the physical network. Eventually when I start the virtual machine, the guest OS will do some reconfiguring for the new hardware, but that’s okay.

Windows 8 Hyper-V configure network

Now comes the main part. I already have a preconfigured disk so I’m not going to create a new one. Instead, as you see below in Figure 7, I’m going to specify the path to the exiting VHD file.

Windows 8 Hyper-V connect virtual hard disk

Clicking Next brings me to the summary page as depicted below in Figure 8.

Windows 8 Hyper-V summary

Clicking Finish will get the job done, as you can see below.

Windows 8 Hyper-V click finish

Before firing up the virtual machine, I’ll take a quick look at its settings.

Windows 8 Hyper-V settings

When you are using an existing VHD with a pre-installed operating system, hopefully you know what hardware configuration it is using. You may need to adjust settings accordingly. For example, if I knew the operating system on the VHD is expecting two processors, I can go ahead and add a second one. These settings should be okay, so I’ll close them and fire up the new virtual machine based on an existing VHD.

Naturally, because an operating system is already installed, you’ll need to know the necessary credentials to log on. For Windows-based operating systems, the virtual machine should detect new hardware and install drivers or software as needed. More than likely you will need to reboot the virtual machine. By the way, if you need to send Ctrl+Alt+Del to the virtual machine, use Ctrl+Alt+End. Or, in the Virtual Machine Connection window, select Ctrl+Alt+Del from the Action menu.

There is one final step to make, especially if your VHD is running a Windows operating system: Install integration services after rebooting (or before if you can). These services make it easier to manage the virtual machine from the Hyper-V manager.

From the Action menu in the Virtual Machine Connection window, select Insert Integration Services Setup Disk. This assumes your virtual machine has a DVD device. Launch the setup according to your operating system. Follow the prompts and reboot if necessary. You can configure integration services under settings. But unless you have some very specific needs, I’d stick with the defaults.

Windows 8 Hyper-V settings

Posted 05/10/2012 by Petri in Hyper-V

Configuring Virtual Networks With Hyper-V   1 comment

The Virtual Switch

What really sets Hyper-V apart from Microsoft’s other virtualization products is that virtual machines perform much better because they can communicate with the server’s hardware directly rather than having to pass hardware requests through the host operating system (although there are some exceptions to this). Of course you can’t just bombard a network adapter with simultaneous traffic from multiple virtual machines. There has to be a way of managing the traffic. To get around this problem, Microsoft has introduced the concept of the virtual switch.

To understand how this is possible, you have to realize that Hyper-V is not a Windows Server 2008 add-on, but rather is a part of the operating system. When you install the Hyper-V role, the hyper visor is placed “underneath” the Windows 2008 operating system. The existing operating system (known as the host operating system) is placed into something called the parent partition, and each guest operating system is placed into a separate child partition.

To make this type of architecture possible, Microsoft had to unbind the host operating system’s TCP/IP stack from the server’s NIC. In doing so, they have created an additional layer of abstraction known as the virtual switch. The virtual switch is the only networking component that is bound to the physical network adapter. The parent partition and the child partitions use virtual network adapters (known as vNICs), which communicate with the virtual switch using Microsoft’s Virtual Network Switch Protocol.

I realize that this description may be difficult to follow, so I have created the diagram shown in Figure A as a way of helping you to understand the architecture.


Figure A This is what the virtual switch architecture looks like.

Additional Virtual Switches

Hyper-V allows you to create additional virtual switches beyond the one that I just talked about. To do so, open the Hyper-V Manager and then click on the Virtual Network Managerlink. Upon doing so, Windows will display the Virtual Network Manager screen, shown in Figure B.

Figure B The Virtual Network Manager allows you to create additional virtual switches.

If you look at the figure above, you can see that the default virtual switch is bound to my physical network adapter. You also have the option of creating a new virtual network, which is the same as creating a new virtual switch. As you can see in the figure, there are three different types of virtual networks that you can create.

Your first option is to create an external virtual network. Doing so creates a virtual switch through which virtual machines can access your entire network, and even the Internet assuming that you have the necessary infrastructure in place.

One thing that you do need to know about external virtual networks is that they must be bound to a physical network adapter. Additionally, each physical network adapter can only be used for a single virtual network. Therefore, if you are creating a secondary external virtual network then you’re going to need a secondary NIC that you can bind the new external virtual network to.

Your next option is to create an internal virtual switch. An internal virtual switch is not capable of accessing the yarn that, or even your private network as a whole. It serves primarily as a mechanism for allowing communications between the virtual machines that are hosted on the server. Additionally, an internal virtual network can facilitate communications between the host operating system and the guest operating systems that are running on it.

Your third option is to create a private virtual network. A private virtual network can only be used to facilitate communications between the virtual machines that are hosted on the current server. Private virtual networks can not access the outside world, nor can they access the host operating system.

Posted 04/10/2012 by Petri in Hyper-V