Category: Windows Server 8

Windows Server 2012 Hyper-V: Smart Paging

Windows Server 2012 RC Logo

If you have installed the Windows Server 8 Beta or the Windows Server 2012 Release Candidate and have tested the new version of Hyper-V, you may have seen a new feature in the Hyper-V Manager Console called Smart Paging.

What is Smart Paging and what does it do. To understand what Smart Paging is we have to go back in time, to the release of Service Pack 1 for Windows Server 2008 R2 or Hyper-V Server 2008 R2. In Service Pack 1 Microsoft added a new feature to Hyper-V called Dynamic Memory. Dynamic Memory allows to dynamically add and remove virtual memory from a Virtual Machine depending on memory demand of the VM. You can set the start up memory and the maximum memory

Hyper-V Dynamic Memory

Now in Windows Server 2012 Hyper-V Microsoft improved the Dynamic Memory feature and also added a third option the minimum memory.

  • Startup RAM – Memory during the startup process until the Dynamic Memory driver is started.
  • Minimum RAM – the minimum of RAM a VM can get.
  • Maximum RAM – the maximum of RAM a VM can get.

For example the VM needs 1GB of RAM to start all service properly, and after the start the memory demand can go down to 512MB you would set the Startup RAM to 1GB and the Minimum RAM to 512MB.

Hyper-V Smart Paging

Now with the new Minimum RAM setting there is a new problem, if the VM is running with a minimum of RAM and for example 512MB and all other memory resources of the host are used by other Virtual Machines and you restart the VM, the VM can maybe not get the full 1GB of startup memory. In this case, and this is the only case, Smart Paging is used to allocate the additional 512MB of RAM in a page file outside the Virtual Machine so all services can start properly.

 

 



Windows Server 2012 Hyper-V – Welcome to the Post-VMware Era!

Windows Server 2012

Today is the day Microsoft official releases Windows Server 2012 and Microsoft is doing a virtual launch event. Windows Server 2012 is a huge step forward for Microsoft virtualization technology Hyper-V.

I the past year I wrote a lot of blog post about the new features in Windows Server 2012 and Hyper-V. I also did some comparing between VMware vSphere 5 and Windows Server 2012 Hyper-V.

First to get an overview about the new feature in Windows Server 2012 Hyper-V you should check out my blog post: Hyper-V 2012 – Hey I Just Met You And This Is Crazy

Windows Server 2012 Hyper-V Features

You can find some advanced blog posts about new technologies, which cover for example Hyper-V Replica, Converged Fabric and Cluster-Aware Updating here:

Hyper-V vs. VMware

If you are a VMware vSphere user at the moment, you should checkout my blog post series about Hyper-V vs. VMware.

Gartner Hyper-V

Hyper-V and Windows PowerShell

If you are deploying Windows Server 2012 in your environment have a look at PowerShell. Windows PowerShell v3 which is included in Windows Server 2012 and Windows 8 is also a great release. I recommend reading the following posts:

Hyper-V and System Center

To manage Hyper-V Microsoft offers System Center 2012 and with the release of Service Pack 1 Microsoft will support the new features in Windows Server 2012.

Interview about the new feature in Windows Server 2012 Hyper-V

In July I met with Carsten Rachfahl who is a MVP for Virtual Machine and the owner of hyper-v-server.de. Carsten was visiting Switzerland and he also took the time to do some interviews and I had the chance to speak with him.

In the interview (in german) we talked about the new release of Windows Server 2012 Hyper-V which is included in Windows Server 2012:

Next Events

Downloads

Credits for the blog post title go to Michael Faden from Microsoft Switzerland.



Upgrade Windows 8 Customer Preview to Windows 8 Release Preview ;-)

Windows 8 Upgrade

For those who are going to install the Windows 8 Release Preview. You cannot upgrade from Windows 8 Customer Preview. Same for the Windows Server 8 beta to Windows Server 2012 Release Candidate.



Windows Server 2012 Hyper-V: Convert VHD to VHDX

VHDX

With Windows Server 2012 Microsoft released a new Virtual Disk Format called VHDX. VHDX improves the Virtual Disk in a lot of way.

Back in October I wrote a blog post on the improvements of the VHDX Format in the Windows Server 8 Developer Preview. Back then VHDX supported a size of 16TB, with the release of the Windows Server 8 Beta (Windows Server 2012 beta) the new Maximum size changed to 64TB.

Some of the VHDX improvements:

  • Support up to 64TB size
  • Supports larger block file size
  • improved performance
  • improved corruption resistance
  • the possibility to add meta data

You can download the VHDX Format Specification.

To use this new features you have to convert your existing VHDs into the new VHDX format. You can this do in two different ways, with the Hyper-V Manager or with Windows PowerShell.

Convert VHD to VHDX via Windows PowerShell

To convert a VHD to a VHDX with Windows PowerShell you can use simple this PowerShell command:

[powershell] Convert-VHD TestVHD.vhd -VHDFormat VHDX -DestinationPath C:\temp\VHDs\TestVHDX.vhdx -DeleteSource  [/powershell]

Of course you can convert the VHDX back to a VHD using the following command:

[powershell] Convert-VHD TestVHDX.vhdx -VHDFormat VHD -DestinationPath C:\temp\VHDs\TestVHD.vhd -DeleteSource  [/powershell]

Convert VHD to VHDX via PowerShell

Convert VHD to VHDX via Hyper-V Manager

  1. Start the Hyper-V Manager and click on “Edit Disk…
    Hyper-V Manager
  2. Now select the VHD you want to convert
    Edit Virtual Hard Disk
  3. Select “Convert
    Convert Virtual Hard Disk
  4. Select the target format in this case VHDX
    Convert VHD to VHDX
  5. Select the new location for your new VHDX
    Convert VHD to VHDX Location
  6. Check the summary and click finish
    Convert VHD to VHDX Finish

 

Same as with the PowerShell command, you can also convert a VHDX to a VHD. But you have to make sure that the VHDX is not bigger than 2TB.

Aviraj Ajgekar already did a post on this TechNet blog about how you can convert a VHD to VHDX via Hyper-V Manager.

 



Windows Server 2012 – Add and Remove GUI

Windows Server 8

Microsoft worked hard on the management of the new Windows Server 2012. In Windows Server 2008 R2 you had to choose during the Installation if the Server is a Windows Server Full Installation (with GUI) or a Windows Server Core Installation (without GUI). In Windows Server 2012 you can add and remove the GUI from the server.

Add GUI on a Core Server

On a Core Server you can add the with the following PowerShell command

[powershell]
Add-WindowsFeature Server-GUI-Shell
[/powershell]

add-windowsfeature server-gui-shell

After the Installation you have to restart the server

[powershell] Restart-Computer[/powershell]

AddGUIPowershell

Remove GUI on a Server

There are two ways you could do that, first via Server Manager remote the GUI feature:

RemoveGUI

Or via Windows PowerShell

[powershell] Remove-WindowsFeature Server-GUI-Shell[/powershell]

Remove GUI with Powershell

It is also important that you understand that Windows Server 2012 has three different GUI options.

  • Core
  • GUI
  • GUI with Management Tools

So if you activate the GUI you do not get all of the Management tools automatically. You have also to activate the “Management tools GUI”.



FreeBSD Support on Windows Server Hyper-V

Hyper-V R2 SP1

Big news from the Open Source guys at Microsoft. Microsoft, Citrix and NetApp together with the FreeBSD community announced the support of FreeBSD for Hyper-V. I think this is a very important step to get Hyper-V in a better position. A lot of Hosting providers I know are running FreeBSD machines, and now with the support they can run it on Hyper-V.

Check out this post about FreeBSD Support on Windows Server Hyper-V on [email protected] blog.

Virtualization technology plays an increasingly critical role at all levels of IT, from the desktop to the datacenter. As more organizations use virtualization to manage mission-critical workloads, they are taking advantage of the cost-saving benefits of server consolidation and building foundations for private, public and hybrid cloud computing. To help customers adopt virtualization and progress toward cloud computing, Microsoft is committed to supporting multiple platforms with its server virtualization solution. Tomorrow at BSDCan 2012, Microsoft and its partners NetApp and Citrix will extend this cross-platform commitment, presenting FreeBSD support on Windows Server Hyper-V.

The FreeBSD drivers will allow FreeBSD to run as a first-class guest on the Windows Server Hyper-V hypervisor. The drivers will be fully released early this summer, including the source code for the drivers under the BSD license, and will initially work with FreeBSD 8.2 and 8.3 on Windows Server 2008 R2.

For Microsoft the project breaks new ground – it’s the first project in which open source co-development was done with commercial partners like NetApp and Citrix. Also, the FreeBSD community is a new relationship for us relative to other open source communities that we’ve worked with for years. It was invaluable to have partners NetApp and Citrix, both users of and contributors to FreeBSD, be so knowledgeable about how to enable their products to run on Hyper-V with high performance. Given their expertise, they focused their attention mostly on the storage and network aspects of the drivers respectively, but the project was a joint effort in all aspects. Microsoft partnered with Insight Global on developing the VMBUS driver, which is the core that interfaces between the guest operating system and the host Windows Server Hyper-V hypervisor. From the earliest stages the code was intended to be open source, with the goal of incorporating it into the core of FreeBSD. This drove decisions such as using Github as the software development infrastructure.

 

 



Configure Hyper-V Host Network Adapters Like A Boss

Hyper-V R2 SP1

If you are working a lot with Hyper-V and Hyper-V Clustering you know that something that takes a lot of time is configure the Hyper-V Host Network Adapters. First because most of the time you have a lot of NICs build into your host for the different Hyper-V and Cluster networks and secondly Windows names the NICs in a random way and this makes it hard to find out which network card is the right one. Maybe your first NIC on your Hyper-V Host01 is called “Local Area Connection 2” and on your second Hyper-V Host with the same hardware configuration the “same” NIC is called “Local Area Connection 3”. One of the possibilities to find out which network card is the right one is to check the MAC address of the network adapter. But for this you still have to know which MAC address is on which network adapter port.

Another way to do it is to plug in the network cables one by one. So you can see which port is active and then you can rename the network adapter. Now some times this one is one of the only solutions, but it takes a lot of time to do this on every host. And if you build Clusters up to 16 Hosts you really don’t want to do that.

Now there is a solution, you can sort your NICs by PCI bus and PCI slot. Maarten Wijsman did a blog post how you can do this on the Hyper-V.nu blog. With this knowledge you can start to automate this very easy.

networkcable

I have created two Windows PowerShell scripts which make my life a lot easier.

First I configured the first Hyper-V host and renamed all the Network adapters. If you have a GUI server you could do that via GUI or if you have a Windows Server Core or Hyper-V Server you can do this via netsh.

[powershell]
netsh interface set interface “Local Area Connection 2″ newname=”Management”
[/powershell]

If I have done that I use my  Windows PowerShell script called Get-NICInformation.ps1 to get the information about the network adapters.

get-nicinformation

This gives me a lot of information about the NICs in my first hosts. But the important part is the order of the NICs. In my example I know that the order is this:

  • Management
  • VMNet
  • CSV
  • LiveMigration
  • iSCSI01
  • iSCSI02

Since my other hosts have the same hardware they will have the same PCI Bus order.

[powershell]
# ———————————————————————————————- #
# Powershell Get-NICInformation $Rev: 748 $
# (c) 2011 Thomas Maurer. All rights reserved.
# created by Thomas Maurer
# www.thomasmaurer.ch
# www.itnetx.ch
# last Update by $Author: tmaurer $ on $Date: 2012-02-24 14:07:36 +0100 (Fr, 24 Feb 2012) $
# ———————————————————————————————- #

#region [INFO BLOCK]
# INFO
Write-Host ” ” -BackgroundColor Black -ForegroundColor White
Write-Host ” PowerShell Get-NICInformation ” -BackgroundColor Black -ForegroundColor White
Write-Host ” ” -BackgroundColor Black -ForegroundColor White
Write-Host ” by Thomas Maurer ” -BackgroundColor Black -ForegroundColor White
Write-Host ” www.thomasmaurer.ch ” -BackgroundColor Black -ForegroundColor White
Write-Host ” ” -BackgroundColor Black -ForegroundColor White
#endregion

$adapters = Get-WMIObject Win32_PNPSignedDriver | Where-Object { $_.DeviceClass -eq “NET” -and $_.HardWareID -like “*PCI*” } | Sort-Object location

foreach ($adapter in $adapters ) {

$adapterName = Get-WMIObject Win32_NetworkAdapter | Where-Object { $_.PNPDeviceID -eq $adapter.DeviceID }
$adapterConfiguration = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object { $_.index -eq $adapterName.Index }

Write-Host ‘Adapter Name :’ $adapterName.NetConnectionID
Write-Host ‘PCI BUS :’ $adapter.Location
Write-Host ‘MAC Address :’ $adapterName.MACAddress
Write-Host ‘GUID :’ $adapterName.GUID
Write-Host ‘Adpater Index :’ $adapterName.Index
Write-Host ‘Hardwarename :’ $adapterName.Name
Write-Host ‘DHCP enabled :’ $adapterConfiguration.DHCPEnabled
Write-Host ‘IP Address :’ $adapterConfiguration.IPAddress
Write-Host ‘Subent :’ $adapterConfiguration.IPSubnet
Write-Host ‘Default Gateway :’ $adapterConfiguration.DefaultIPGateway
Write-Host

}
[/powershell]

For the next step I go to my second host. There I have my other Windows PowerShell script (Set-IPAddressfromXML) and a XML file (networkconfig.xml).

dir

I edit the networkconfig.xml file with the correct network information. Important here are the id=”” parameters. They are showing the order of the NICs so with Get-NICInformation I can see the Management interface is the first one, so it gets id=”1″, VMNET is the second one it gets id=”2″ and so on. You also set the correct IP Address information for the second host. Most of the time you just have to change the last number.

You can also set non static IP Addresses (DHCP), in my case I did this for the VMNET adapter which will be used by the Hyper-V Virtual Switch and does not need a IP address.

networkconfigxml

[xml]

[/xml]

After you have done this, you can now simply run the Set-IPAddressfromXML script. This will use the Information from the networkconfig.xml file and will rename all network adapters and will set the correct IP addresses.

set-ipaddressfromxml

[powershell]
# ———————————————————————————————- #
# Powershell Set-IPAddressfromXML $Rev: 748 $
# (c) 2011 Thomas Maurer. All rights reserved.
# created by Thomas Maurer
# www.thomasmaurer.ch
# www.itnetx.ch
# last Update by $Author: tmaurer $ on $Date: 2012-02-24 14:07:36 +0100 (Fr, 24 Feb 2012) $
# ———————————————————————————————- #

#region [INFO BLOCK]
# INFO
Write-Host ” ” -BackgroundColor Black -ForegroundColor White
Write-Host ” PowerShell Set-IPAddressfromXML ” -BackgroundColor Black -ForegroundColor White
Write-Host ” ” -BackgroundColor Black -ForegroundColor White
Write-Host ” done by Thomas Maurer ” -BackgroundColor Black -ForegroundColor White
Write-Host ” www.thomasmaurer.ch ” -BackgroundColor Black -ForegroundColor White
Write-Host ” ” -BackgroundColor Black -ForegroundColor White
#endregion

#region [CONFIG BLOCK]
# Get XML Information
[Xml]$global:xmlData = Get-Content “.\networkconfig.xml”
# Set NIC number starting value
[int]$global:nicNumber = “1”
#endregion

#region [MAIN BLOCK]
#Get NIC list
$Adapters = Get-WMIObject Win32_PNPSignedDriver | where { $_.DeviceClass -eq “NET” -and $_.HardWareID -like “*PCI*”} | Sort-Object location

foreach ($Adapter in $Adapters ) {
# Get Adapter Info
$AdapterName = Get-WMIObject Win32_NetworkAdapter | where { $_.PNPDeviceID -eq $Adapter.DeviceID }
$nic = $xmlData.config.networkadapters.nic | Where-Object {$_.id -eq $nicNumber}

# Write NIC Info
Write-Host ‘Adapter Name :’ $AdapterName.NetConnectionID
Write-Host ‘PCI BUS :’ $Adapter.Location
Write-Host ‘MAC Address :’ $AdapterName.MACAddress
Write-Host ‘GUID :’ $AdapterName.GUID
Write-Host ‘New Name :’$nic.name
Write-Host

# Change NIC Name
Invoke-Expression (‘netsh interface set interface `”‘ + $AdapterName.NetConnectionID + ‘`” newname=`”‘ + $nic.name + ‘`” | out-null’)
Write-Host (‘netsh interface set interface “‘ + $AdapterName.NetConnectionID + ‘” newname=”‘ + $nic.name + ‘”‘) -BackgroundColor Green -ForegroundColor Black

# if true set IP Address
if ($nic.static -eq “true”){
Invoke-Expression (‘netsh interface ipv4 set address `”‘ + $nic.name + ‘`” static ‘ + $nic.ip +’ ‘ + $nic.subnet + ‘ ‘ + $nic.gateway + ‘ | out-null’)
Write-Host (‘netsh interface ipv4 set address “‘ + $nic.name + ‘” static ‘ + $nic.ip +’ ‘ + $nic.subnet + ‘ ‘ + $nic.gateway) -BackgroundColor Green -ForegroundColor Black
}
else {
Write-Host “No IP set” -BackgroundColor Green -ForegroundColor Black
}

# Count +1 for next Adapter
$nicNumber++
}
#endregion
[/powershell]

 

I can now copy the Set-IPAddressfromXML.ps1 and the networkconfig.xml to each Hyper-V hosts and edit the IP Addresses in the xml file, run the PowerShell file and I am done.

Lets recap:

  1. Rename the NICs of the first hosts
  2. Run the Get-NICInformation.ps1 on the first host and check the NIC order
  3. Edit the networkconfig.xml on the second hosts with the right order of the NICs
  4. Run the Set-IPAddressfromXML.ps1
  5. Do this for all Hyper-V Hosts.

I hope this will make life easier 🙂

You can download the Scripts from my Skydrive

Some other things:

  • I have tested this with Windows Server 2008 R2, Hyper-V Server R2, Windows Server 8 beta, Hyper-V Server 8 beta
  • It works for both because it’s not done with PowerShell v3, maybe I will update it to get it even better.
  • I do not support this script, and you are running it on your own risk.