Setting MMU for your VMs

I was asked by my friend Duncan if it was easy enough to set the Memory Management Unit (MMU) for each of his VM’s.  Read his post here for more information on what he was working on.

He was about to set this by hand for 50+ VM’s which would take a while, so with the power of the VI Toolkit he can now take it easy whilst PowerShell does the hard work:

For one VM:
Get-VM -Name "MyVM" | Get-View | foreach {
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo
    $spec.flags.VirtualMMuUsage = "on"
    $taskMoRef = $_.ReconfigVM_Task($spec)
}
For all VMs you could use:
Get-VM | Get-View | foreach {
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo
    $spec.flags.VirtualMMuUsage = "on"
    $taskMoRef = $_.ReconfigVM_Task($spec)
}
Or for each of the VMs in a cluster:
Get-Cluster "MyCluster" | Get-VM | Get-View | foreach {
    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo
    $spec.flags.VirtualMMuUsage = "on"
    $taskMoRef = $_.ReconfigVM_Task($spec)
}

To list each of the VM’s and their current MMU setting use this one-liner:

Get-VM | Get-View | ForEach {Write "$($_.Name) - $($_.Config.Flags.VirtualMmuUsage)"}

11 thoughts on “Setting MMU for your VMs

  1. Pingback: VMware ESX CPU/MMU Virtualization Settings | trainingrevolution

  2. Pingback: Running OpenStack Private Cloud on ESXi | Professional OpenStack

  3. Doug

    To see which settings are actively in use, you need to grep “HV Setting” against the vmware.log file for the VM. You will have to run it from the host that the VM runs on. http://dferguson75.wordpress.com has the details (I’d copy/paste them but there’s a web filter preventing my access to the site currently).

  4. Pingback: Set Disk.UseDeviceReset with powershell » Yellow Bricks

  5. Virtu-Al

    I have adjusted the post to give you a one-liner which will list there current setting.

  6. PiroNet

    Yup he came back to me on VMware Communities as well.
    BTW how would you do to test first if guest is a w32bit rather than x64bit one ?

    Thx 😉

  7. Pingback: Virtualized MMU and Transparent page sharing » Yellow Bricks

  8. Virtu-Al

    Thats a very good question, one unfortunatly I do not know the answer for, you can list from the vm side of things what that option is set too but im guessing the actual detection would need to be done from inside the guest OS, I wonder how you can tell ? I will have a look.

  9. PiroNet

    Quick question comes to my mind…
    How do you tell the actual state of the virtualized MMU ?
    Sure by default it is set to ‘Allow the host….’ but then is it ON or OFF ?

    Thx

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.