Friday, July 16, 2010

Timekeeping on Linux VMware Guests

Timekeeping on Linux VMware guests can be a cumbersome and frustrating experience. I'm creating this post to be able to remind myself of the various settings required to make things work. The bulk of this information is taken from VMware KB article #1006427 located at:
http://kb.vmware.com/kb/1006427.

VMware recommends using NTP and turning off VMware Tools periodic time synchronization in the guest. To turn this off, there are three options:

  1. Set tools.syncTime = "False" in the configuration file (.vmx file) of the virtual machine.

  2. OR

  3. Deselect Time synchronization between the virtual machine and the host operating system in the VMware Tools toolbox GUI of the guest operating system.

  4. OR

  5. Run the vmware-guestd --cmd "vmx.set_option synctime 1 0" command in the guest operating system.
To work properly in a VM, some vendor kernels require certain kernel parameters. In our environment, we only run SLES and RHEL so I'm only concerned about those two. If you run something different, check the VMware KB article linked to above.


Architecture

Linux Version

Kernel Parameters

Notes
64bitRHEL 5.4 and later
No additional kernel parameters.
32bitRHEL 5.4 and later
No additional kernel parameters.
64bitRHEL 5.3notsc divider=10
32bitRHEL 5.3divider=10 clocksource=acpi_pm
64bitSLES 10.2 and later
No additional kernel parameters.
32bitSLES 10.2 and later
Use a VMI enabled kernel.



You now want to make sure that NTP is configured correctly for your environment.

The following is a sample /etc/ntp.conf :

server ntp1.somedomain.org
server ntp2.somedomain.org
restrict 127.0.0.1
restrict default nomodify nopeer
driftfile /var/lib/ntp/drift