Time Is Marching On… Disabling TimeSync, Completely.

Time is critical.

In VMs this criticality is even more pronounced. Time slips… CPU instructions go askew, and things get weird. That said, there are situations when you may wish to disable the built in VMware Tools Time sync service… completely. What do I mean by completely? Well, even with the tools time sync set to disabled, VMware will force a VM to sync with the host in some specific situations, and despite my valiant Google effort, I was unable to uncover exactly what these are.

According to KB 1189, you can disable TimeSync completely by adding a few parameters to the config file:

If you want to completely disable time synchronization in the guest, open the virtual machine’s configuration file (.vmx) in a text editor and set the following options to zero, as shown below.

tools.syncTime = "0"
time.synchronize.continue = "0"
time.synchronize.restore = "0"
time.synchronize.resume.disk = "0"
time.synchronize.shrink = "0"
time.synchronize.tools.startup = "0"

While that is borderline awesome… when combined with Glenn’s script from get-admin:

$ExtraOptions = @{
    "tools.syncTime"="0";
    "time.synchronize.continue"="0";
    "time.synchronize.restore"="0";
    "time.synchronize.resume.disk"="0";
    "time.synchronize.shrink"="0";
    "time.synchronize.tools.startup"="0";
}   # build our configspec using the hashtable from above.  I prefer this
# method over the use of files b/c it has one less needless dependency.
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
# note we have to call the GetEnumerator before we can iterate through
Foreach ($Option in $ExtraOptions.GetEnumerator()) {
    $OptionValue = New-Object VMware.Vim.optionvalue
    $OptionValue.Key = $Option.Key
    $OptionValue.Value = $Option.Value
    $vmConfigSpec.extraconfig += $OptionValue
}
# Get all vm's not including templates
$VMs = Get-View -ViewType VirtualMachine -Property Name -Filter @{"Config.Template"="false"}   # Do it!
foreach($vm in $vms){
    $vm.ReconfigVM_Task($vmConfigSpec)
}

There you have it. Time disabled in all your VMs.

10 thoughts on “Time Is Marching On… Disabling TimeSync, Completely.

  • From KB *1006427*
    “NTP Recommendations *Note*: In all cases use NTP instead of VMware Tools
    periodic time synchronization. Also, you may need to open the firewall (UDP
    123) to allow NTP traffic.”

    In some situations, such as a VM moving from one host to another, or
    resuming from snapshot, the VMware tools will force a sync of time. The
    period of time between this time sync and the next update from NTP may be
    otherwise unacceptable in some environments.

    -C

  • Pingback: Tweets that mention Time Is Marching On… Disabling TimeSync, Completely. -- Topsy.com
  • How does one decide how critical time is??
    All our hosts are set to ignore the Windows time service and get their time from the ESX host, which gets its time from our external physical server (DNS, NTP, etc.), which itself looks to pool.ntp.org.
    We don't do anything that requires sub-second precision, so how do we decide where time should sync from??
    Our ESX hosts don't have Internet-accessible addresses.
    Thank you, Tom

  • From KB *1006427*
    “NTP Recommendations *Note*: In all cases use NTP instead of VMware Tools
    periodic time synchronization. Also, you may need to open the firewall (UDP
    123) to allow NTP traffic.”

    In some situations, such as a VM moving from one host to another, or
    resuming from snapshot, the VMware tools will force a sync of time. The
    period of time between this time sync and the next update from NTP may be
    otherwise unacceptable in some environments.

    -C

  • How does one decide how critical time is??
    All our hosts are set to ignore the Windows time service and get their time from the ESX host, which gets its time from our external physical server (DNS, NTP, etc.), which itself looks to pool.ntp.org.
    We don't do anything that requires sub-second precision, so how do we decide where time should sync from??
    Our ESX hosts don't have Internet-accessible addresses.
    Thank you, Tom

Comments are closed.