segunda-feira, 11 de maio de 2009

Guest clock runs too fast - guest / host clock synchronization

Seems that millions of VMWare users are having clock drift problems through different OS versions. A google search will return too many result with too many different solutions.

Here's what to do if your guest clock runs too fast under VMWare Server.

Host Operating System

1. Find your maximum CPU frequency:
cat /proc/cpuinfo |grep -i mhz

2. Add the following lines to /etc/vmware/config:
host.cpukHz = 2800000 (replace with your CPU MHZ * 1000)
host.noTSC = TRUE
ptsc.noTSC = TRUE
3. Restart VMWare.

Guest Operating System

4. Change your kernel boot parameters according to the table found here.
5. Configure ntpd according to this document.
6. Ensure ntpd starts on boot.
7. Reboot.

This was tested under VMWare 1.0.9 running on a Centos 5.3 64bit host with CentOS 5.3 64 bit guests. All kernels are SMP.


Apparently even with the above procedure the guest clock still runs faster something like 1/2 minute per hour. If the applications running on the VM are not time-sensitive one can run an hourly ntpdate cron job instead of ntpd (ntpd doesn't work if the guest clock drifts too much).

may be that disabling power management on the host helps but I wouldn't go that route given a "good enough" solution as described above, that will work well for the scenarios the guest is being used on.

2 comentários:

Luís Miguel Silva disse...

Cool tip! Thanks for sharing :o)

Carlos Rodrigues disse...

I find that passing the following parameters to the guest's kernel and using vmware-tools to synchronize the clock is usually good enough:

"noapic nolapic nosmp clocksource=acpi_pm"

Using "ntpd" is not a good way to keep the time in sync. It mostly works, but since it tries to keep the clock synchronized between checks to the ntp servers by tuning kernel parameters, it transforms small forward jumps in the clock into longer periods of desynchronization.