HGSDiag
is a command-line tool which can kill running VMs and do other interesting things. Highly recommended.
Category: Virtual Machines & Environments
Manage Running Hyper-V Virtual Machines with HCSDiag.exe
article #1502, updated 716 days ago
Virtual Machine Queues
article #1420, updated 1291 days ago
In general Virtual Machine Queues are often disabled on Hyper-V hosts, to solve network slowness. However, if we go here:
HKLM\SYSTEM\CurrentControlSet\Services\VMSMP\Parameters
and add DWORD BelowTenGigVmqEnabled
and set it to 1, or TenGigVmqEnabled
for 10G, we can enable Virtual Machine Queues and get great speed indeed.
Hyper-V integration services under Server 2016 Hosts
article #1211, updated 2306 days ago
Integration services are no longer automatically installed or automatically available, to guests running operating systems older than 10, on hosts running 2016. They have to be installed by powershell or DISM, directly into the guest, not the host. I found DISM to work when powershell didn’t. The appropriate image addition is downloaded here:
and then installed thus, e.g. for Windows 7/2008R2:
DISM /Online /Add-Package /PackagePath:C:\storage\windows6.x-hypervintegrationservices-x64.cab
Measure available IOPS for Hyper-V drive image QoS
article #1191, updated 2310 days ago
A good tool here:
woshub.com/how-to-measure-disk-iops-using-powershell/
Once having downloaded and unpacked this or this, get to an administrative PowerShell, and here’s the command:
.\DiskPerformance.ps1 -TestFileName test.dat –TestFileSizeInGB 1 -TestFilepath C:\temp -TestMode Get-SmallIO -FastMode True -RemoveTestFile True -OutputFormat Out-GridView
It is important to use a -TestFileSizeInGB larger than the cache on the RAID, and set -TestFilePath to a folder on the RAID whose IOPS capacity you need to measure, or else you will not be measuring the correct data.
This is very helpful when we need to increase performance on a Hyper-V guest. After CPU and memory usage are good, with their averages being medium or low, the last bottleneck is hard drive bandwidth. If you get this right you can improve Hyper-V guest performance a lot:
- Browse to the Advanced under each VHD, there is a QoS section.
- The above performance test will run several times if you let it. Approximate the maximum by a rough average of the list.
- For now, let’s say all VHDes are on the same RAID, and that you ran the above correctly on that RAID (-TestFilePath has to be set!), and that you averaged the values given to about 1800.
- For each VHD, set the minimum QoS to 100 (5%), and the maximum to 1700 (95%). This makes sure that the hypervisor doesn’t let any of them “spin down” all the way, so latency is nice and low; and it also makes sure that the hypervisor knows to give the guests priority on their RAID volume.
XP Mode helps
article #1165, updated 2435 days ago
- There are three ways to reset the password if you need to do so:
https://www.mydigitallife.net/reset-and-fix-incorrect-or-wrong-password-for-windows-xp-mode-xpmuser/
- If you need to transfer an XP mode virtual from one user profile to another, create a blank XP mode on the new user, then copy all of the old files replacing the new. Use the default filenames, don’t change anything. It will work, but you will need to change the password, above.
Setting Virtual Disk QoS in Hyper-V
article #1042, updated 2751 days ago
Disclaimer: this text is an draft combining references cited at the bottom with experiences. It is not authoritative.
Getting to the Settings
- In Hyper-V, enter Settings for a VM, click on a disk image under a controller, open the plus sign, and you’ll see Advanced Features.
- Click on that, and you’ll see a checkbox, “Enable Quality of Service management”.
- If you check that box, you can enter minimum and maximum IOPS numbers.
- If either number is zero, the configuration is inoperative, it reverts to automatic.
- It is a separate setting for each disk image of the guest.
Determining Good Values for the Settings
- In an administrative powershell on the virtual host, do this, just once forever:
get-VM | Enable-VMResourceMetering
- Run Iometer on the virtual guest.
- Choose one disk under Disk targets. Set Write IO Data Pattern “Pseudo random”. Set “Test Connection Rate” to 10.
- Under Access Specifications, scroll to the bottom, choose All in one, and click Add.
- If you want interesting GUI displays of the I/O readouts, make changes under Results Display.
- Under Test Setup, open the Cycling Options dropdown and choose carefully. You’ll probably want to Cycle, but which other setting you want depends on the architecture of the guest and possibly the host.
- Click the green flag button. The chosen disk image is now under load. You may want to try higher numbers for “Test Connection Rate”, but do realize this sets how hard we are trying to stress the server, and if we try too hard bad things can happen :-)
- While the disk image is under load, in administrative PowerShell, do this, where GUESTNAME is the name of the virtual guest:
measure-VM GUESTNAME | fl
- You’ll see a number next to AggregatedAverageNormalizedIOPS. If your guest has just one disk image, this is the number you need to study (but do not just plug it into the setting!). If your guest has more than one, you’ll need to split them with the code below.
- Splitting the AggregatedAverageNormalizedIOPS number
Paste the below into your PowerShell on the host, where GUESTNAME is the name of the guest. It will give you separate numbers, including IOPS Averages for every disk image in production.
$VMName = "GUESTNAME" enable-VMresourcemetering -VMName $VMName $VMReport = measure-VM $VMName $DiskInfo = $VMReport.HardDiskMetrics write-Host "IOPS info VM $VMName" -ForegroundColor Green $count = 1 foreach ($Disk in $DiskInfo) { Write-Host "Virtual hard disk $count information" -ForegroundColor cyan $Disk.VirtualHardDisk | fl * Write-Host "Normalized IOPS for this virtual hard disk" -ForegroundColor cyan $Disk $count = $Count +1 }
- Once you have your Average Normalized IOPS number for the virtual disk, we need to think about it a bit.
- On one particular setup with two virtuals having one disk image each, where the number showed at 20,000, I set Maximums all to 7000, and Minimums to 1000. This leaves the hypervisor with lots of headroom for its own maintenance, and causes the hypervisor to keep minimum reservation far from zero, to minimize latency. Obviously the Minimum will be much lower if the RAID on the host is less powerful, and just as obviously if load patterns become evident, maximum will be reduced or increased.
- More variation will need to be employed, depending on observed numerical and practical performance, changes, and miscellaneous needs. A huge and heavily-used volume should deserve to be bumped up some. Early inspection has already shown that there are virtual hosts out there, otherwise nicely fledged servers, lacking in RAID throughput, where the reported average comes to less than 1,100! All of this has to come into consideration.
References
Portable VirtualBox on Windows
article #1003, updated 2928 days ago
VirtualBox, portable, on Windows. Amazing.
Virtualizing XP to KVM
article #377, updated 4706 days ago
Here’s a method which uses the VMware Converter.
http://moblog.bradleyit.com/2010/07/virtualizing-windows-xp-to-kvm-on.html
Cloning Hyper-V Virtual Machines
article #374, updated 4710 days ago
A great article is here:
Hyper-V virtuals on QEMU/KVM
article #373, updated 4713 days ago
The following article is most interesting:
http://blog.allanglesit.com/2011/03/linux-kvm-migrating-hyper-v-vhd-images-to-kvm/
The file format used by Hyper-V in its VHD files, is actually exactly the same as the VPC format used in Virtual PC. And KVM and QEMU do know how to read VPC. So you can do it directly, without conversion; just import an existing disk image into a new KVM virtual and you are there.
But if you want to convert, you can use a utility called “kvm-img”. In some references and some systems, it’s called “qemu-img”. The idea is, that a command line much like this:
qemu-img convert -f vpc -O raw hyper-v-disk-image.vhd kvm-raw-disk.img
will convert your Hyper-V virtual disk image to the “raw” type image which is first on the list for KVM and QEMU.