Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This thought occured to me and while not an actual problem I'm curious to know. When a virtual machine syncs it's clock with the hardware clock does that sync the hardware clock of the host? Change to software clock of the host? Does the time difference between the host and software get stored in a VM's file? Does nothing at all happen?

I know this is a random and seemingly meaningless question but I like to understand what goes on under the hood of all my systems. The direct use case for me is NTPD's SYNC_HWCLOCK in a linux Xen VM but I'm curious about other virtualization platforms as well since they all operate differently.

share|improve this question
up vote 4 down vote accepted

In VMWare at least the hardware clock that the VM's OS sees is no more accurate than its own software clock as that clock is based on counting interrupts and ticks and such from the virtual hardware so is susceptible to skew when the VM or its host are under load.

The VMWare tools clock-sync does not sync against the hardware clock as presented as the clock in the virtual hardware - it talks over the VM/host boundary to the host parts of VMWare (which sync it with the OS clock on the host, not the hardware clock).

Other virtualisation solutions will work differently, of course. I have not used Xen enough to know specifically how it behaves in this area. Some VM solutions (including user-mode schemes like UML and arrangements that partition the existing kernel rather than actually virtualising the hardware) will use the host OS clock as the VM's clock directly so all you need to do is keep the host clock in sync.

In general, even on physical hardware, I would not have NTP use the hardware clock as a reference.

Also, if you are using NTP inside a VM make sure you have "tinker panic 0" at the top of your ntp.conf so that the ntp daemon doesn't give up and stop trying to slide the clock back to the right place when it sees a large clock skew caused by a recent glut of load on the VM/host.

Edit: missed a bit... Also, if using Linux in your VMs make sure you use a modern "tickless" kernel - these are said to be far less susceptible to clock skew problems. Most modern Linux releases use this kernel option by default anyway, as it can reduce CPU power consumption.

share|improve this answer
+1 for the tinker panic. Also, make sure you do not use the local clock as a backup in a VM: only use remote clocks. – wzzrd Jun 19 '09 at 17:55
I've got to say thank you very much for such a thorough answer. I wasn't particularly expecting of this, including some stuff for my best practices documents. ServerFault surprises me with greatness yet again. – TrueDuality Jun 25 '09 at 15:47

I think it's the "hardware" clock of the VM; it'll get simulated along with the rest of the motherboard. There's a separate option in VMWare tools to sync the VM's hardware clocks with that of their host, which I'd recommend you use, as well as getting the hosts to sync with an external NTP server, as that'll save the need to configure NTP on all your VMs. I don't know if it's just us, but we didn't do this when we implemented our VMWare environment, and suffered all sorts of time-related problems and general weirdnesses before we got it sorted out.

share|improve this answer
I recommend you do not use the VMwareTools synctime option under any circumstances. Use ntpd or Win32 synctime or whatever it is called. VMwareTools synctime was designed to make up for lost interrupts. As that does not occur much anymore, and as VMwareTools synctime is unable to slow down a clock if a VM's time is ahead, you'd beter not use it. Anyway, Xen doesn't have VMwareTools. – wzzrd Jun 19 '09 at 17:57

No, it does not sync the hardware or the software clock of the host. A VM's hardware clock is virtual and is synced (at least with ESX) with the host during boot. After that, the VM maintains it's own time. For VMware it is best to run ntpd in a VM, for Xen I do not know, but I assume it's the same.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.