I believe in Hyper-V!

SCVMMCategory Archives

How to reserve a memory for the Hyper-V host and what is a Hyper-V Dynamic Memory

For those who read my blog posts and who don’t know how to reserve memory for the Hyper-V hosts this is a quick guide. This is not new, but today I had this situation and I want to share with you.

First off all I would like to explain what is a Hyper-V Dynamic Memory.

Dynamic Memory is a Hyper-V feature that helps you use physical memory more efficiently. With Dynamic Memory, Hyper-V treats as a shared resource that can be reallocated automatically among running virtual machines. Dynamic Memory adjusts the amount of memory available to a virtual machine, based on changes in memory demand and values that you specify. Here, I’m talking about Hyper-V Dynamic Memory feature in a Windows Server 2008 R2 (Hyper-V role) and Microsoft Hyper-V Server 2008 R2.
Before this feature was introduced, changing the amount of memory available to a virtual machine could be done only when the virtual machine was turned off. With Dynamic Memory, Hyper-V can provide a virtual machine with more or less memory dynamically in response to changes in the amount of memory required by the workloads or applications running in the virtual machine. Hyper-V can distribute memory more efficiently among the running virtual machines configured with Dynamic Memory.
Depending on factors as workload, this efficiency can make it possible to run more virtual machines at the same time on one physical server.

This is how it looks like when we open virtual machine properties through Virtual Machine Manager.

dynamicmemory

But, there is always a but…you could have a problem with memory on your Hyper-V host.
For example; You have a Hyper-V host with 48GB of RAM and 11 virtual machines with 4GB Static RAM assigned. You still have 4GB of RAM reserved for Hyper-V host, but when you have a Dynamic Memory environment, you could give each virtual machine 6GB of RAM. That RAM would be dynamically changed based on virtual machines needs. If virtual machines have a big load, they could grab all RAM leaving your Hyper-V host without RAM.

To avoid this problem you need to reserve RAM for the Hyper-V host. How to do that? Very simple. You need to add some registry values on your Hyper-V host.

Open registry and enter a new REG_DWORD value.

– HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization

– Add New—>DWORD (32-bit) Value

– Name it –> MemoryReserve

– Under Decimal specify the amount of RAM for the Hyper-V host in MB (recommend minimum 2GB of RAM) and restart the Hyper-V host.

2

My recommendation! Use Dynamic Memory environment only for irrelevant services, like testing environment. Do not use Dynamic Memory environment for your production VM’s.

That’s all for today! Have a nice weekend Smile

Prepare Hyper-V virtual machine image for cloning

In one of my previous posts I explained how to Clone a virtual machine with the Virtual Machine Manager, but before Clone our virtual machine we need prepare the virtual machine for cloning.

As you probably know by now, Microsoft-based operating systems use SIDs (Security IDs) that are generated as part of the initial setup of Windows. If you have more than one computer with the same SID, this could cause problems, and cloning a computer (either physical or virtual) without re-generating this SID can cause SID duplication.

Due to the above, we need to prepare virtual machine image for cloning.
This guide assumes that you’ve got some sort of virtualization infrastructure in place. In my case this is a Microsoft Hyper-V. It also assumes that you’ve got some sort of virtualization management tool like System Center Virtual Machine Manager.

In addition, it’s important that you have a basic knowledge about how to set up and run your virtualization product, that you are knowledgeable about setting up virtual machines, and about the proper procedure to install and configure a Windows-based operating system on these virtual machines.

Also, , this guide assumes that you’re knowledgeable about the proper procedures needed to be taken prior to creating a virtual machine clone, how to use SYSPREP (the system preparation tool from Microsoft), and how to create proper answer files for the preparation procedure.

In this post I ‘ll describe how to prepare virtual machine images for Windows Server 2008 R2 and Windows 7.  In Windows Server 2008 R2 and Windows 7 the SYSPREP tool is already included in the operating system, therefore there’s no need to download it like for Windows XP.
To create the proper answer file under Windows Server 2008 R2, Windows 7, you need to either manually edit an existing answer file, or create one for your needs.
To create an answer file for Windows Server 2008 R2 or Windows 7, you must use the tools available in the Windows Automated Installation Kit (AIK) and you can download here.

Preparing the System for Cloning

Prior to cloning the virtual machine there are several steps that you need accomplish. This is not a requirement but is recommended.

  • Log on to the computer as an administrator.
  • Install and customize applications.
  • Customize the Default User profile.
  • Update Windows and other software components.
  • Clean temporary files.
  • Defragment the disk, and compact the VHD file.

Create the UNATTEND.xml Answer File for Windows Server 2008 or Windows 7

Unattended Windows Setup answer file in Windows Server 2008 R2 and Windows 7, is an XML file typically called Unattend.xml. This is the answer file for Windows Setup that is created by using Windows System Image Manager (Windows SIM). The answer file enables the configuration of default Windows settings, as well as the addition of drivers, software updates, and other applications.
The unattended Windows Setup answer file in Windows Server 2008 R2 and Windows 7 needs to be specified during the running of SYSPREP. To do so, run the SYSPREP tool with the /unattend:filename option.

If you wish to manually configure the Windows settings after SYSPREP, run SYSPREP from the C:\Windows\System32\sysprep folder.

1

Make sure you do NOT FORGET to select the “Generalize” option if you need to change the computer’s SID. It seems that this version will NOT change the SID unless you pick that option.

2

Sysprep is working.

3

When the process is complete the virtual machine will shut down.

OK, our VM is prepared for Cloning and if you want to know how to Clone VM with System Center Virtual Machine Manager read my previous post about that.

After starting cloned machine, you will be prompted to configure few settings like the user name, computer name, language and some other settings.

4

I need to mention, creating an answer file will greatly ease this process, and the entire process will automatically run.

Folks that’s it!

Clone Virtual Machine with Virtual Machine Manager

Today I had to Clone a virtual machine in my production environment and I would like to explain how it works. This is a simple procedure with few steps and the whole procedure will be explained as always with many pictures. Before the cloning of virtual machine image you have to prepare the System for Cloning.

As you probably know by now, Microsoft-based operating systems use SIDs (Security IDs) that are generated as part of the initial setup of Windows. If you have more than one computer with the same SID, this could cause problems, and cloning a computer (either physical or virtual) without re-generating this SID can cause SID duplication.

How to prepare the system for cloning I will write in another post.

Step 1.

You must first shutdown virtual machine which you want to Clone. When your VM is turned off, right click on VM and choose Clone.

1

At the second step choose new name for your new virtual machine.

2

On the Configure Hardware field if you need the same hardware configuration like previous VM leave hardware configuration by default or edit what you need.

3

At the next step you need to choose where you want to deploy the virtual machine. I chose “Place the virtual machine on a host”

4

At the next screen I chose host on which was located the previous virtual machine.

5

Select virtual machine path…

6

Specify virtual network…

7

At the end review the virtual machine settings. If you want to start cloned virtual machine immediately check mark “Start the virtual machine after deploying it on the host”  and click Create.

8

The process started.

9

When the process is finished we have two of the same virtual machines whit the same settings.

10

Before you turn on both virtual machines you need to rename the new one. How to do that, especially if your vm’s are in the domain,  I‘ll describe this in my next post.

Until then have a nice week!