Vous êtes sur la page 1sur 13

VMware and TIME

Best Practices for timekeeping in


ESX
Bishop and Miller 2009
Overview

• Background on Computer timekeeping (Graphic)


• How ESX keeps track of time
• The Real Time Clock (RTC)
• Network Time Protocol daemon (NTPd)
• VMware Tools
• Windows Time
• Best Practices
• Recommended reading (KB’s)
• Summary
CMOS / RTC
Real Time Clock
VMKernel
Time copied at
Time Since Boot- NOT real time
boot-up

NTP Console Operating System


Daemon

COS Time
Time copied at
graceful
shutdown

VM
VMWare NTP
Tools Daemon
Unix or Windows Time

Time only moved Time calculated by


forward, except adding OFFSET to
when VM booted HW RTC at GOS
Virtual CMOS / RTC start up
Guest OS Real Time Clock
requests Stored as an OFFSET to the
recalculation by HW CMOS / RTC
updating RTC
Time copied at VM
power up
ESX timekeeping

 The vmkernel does not keep time- it only


keeps the number of seconds since its
startup
 The COS is the timekeeper for ESX for
log messages and other purposes within
the VI3 environment
Real Time Clock (CMOS RTC)
 Keeps time even when the server is shut
off
 This uses the CMOS lithium battery. If this
battery dies the time will reset to the epoch
or a random value at system startup
 The RTC is notoriously inaccurate, due
to temperature fluctuations and inherent
design inaccuracies and component
tolerances.
Real Time Clock (RTC)
 Updated only when COS is gracefully shut
down
 It’s not updated by the COS or vmkernel at any
other time, including startup, ntpd startup, or from
ntpd or any cron job
 You can update it manually from the console using
hwclock --systohc
 The hwclock command can be run from a cron job
running in the COS to keep the RTC time accurate
 In the official timekeeping document, this part of the
RTC is referred to as the “TOD clock”
RTC

 VMs start with an offset of the RTC


determined by the Time Zone in the
Guest
 Since the RTC is inaccurate, this means
that VMs generally don’t start with
accurate time
 Solaris, Linux, and Windows NT, 2000,
2003, XP, and Vista don’t refer to the
RTC as a source at any time but startup
Network Time Protocol (NTP)
 On UNIXes, this is implemented as ntpd or xntpd
 Startup script grabs the time from a timeserver and sets
it in the kernel time location
 The startup time will not correct the kernel time beyond
a certain tolerance, therefore keep the RTC time close
to NTP time
 NTP then checks on a regular basis and adjusts the
kernel time by adding or subtracting ticks
 How often the daemon checks depends on factors
beyond the scope of this presentation
 They have a feature to prevent clock tampering, and will
panic if they find unreasonable values in the clock. To
prevent this, set the “tinker panic” configuration in
ntp.conf to 0.
 The RTC clock can be set in the virtual RTC on Linux
VMs using hwclock; this is a standard Linux program.
VMware Tools TimeSync
 Will advance time in a VM’s shadow RTC, but
will only move it backwards when the VM is
first booted (except on NetWare)
 VMs do not get interrupts from the hardware,
so VMs lose time ticks and their clocks slowly
fall behind
 Timesync designed to compensate for this
 Runs once a minute
 Tools will set the virtual RTC of a VM to the
current COS time at VM power-up
WinTime
 Win32Time
 Kerberos authentication is time sensitive
 Service can be controlled from the Control Panel
Services applet
 Uses SNTP, the Simple Network Time Protocol
 Automatically configured for systems
 Not on NT, use third party app if accurate time is
required and the VM is not a domain member
 Knows about the RTC but remember that in a VM this is
calculated with an offset of the real RTC
 Domain member needs accurate time on the domain
controller. Refer to Microsoft documentation for
instructions on this.
Best Practices

 For accurate time, use NTP in the COS,


or in a VM, or both
 Use NTP in the COS for log file
synchronization between ESX and VC
 The VirtualCenter service (and UM and
so forth) uses its local WinTime client.
 If you are using NTP in a VM, turn OFF
the Vmware tools time sync
Required Reading
 ID: 1003063 - Guide to configure NTP on ESX servers

 ID: 1006427 - Timekeeping best practices for Linux


 ID: 1318 - VMware Time Sync and Windows Time Service

 ID: 1006274 - Time runs quickly in an ESX virtual machine with a Windows guest operating system

 ID: 1006275 - Time run quickly in an ESX virtual machine with a Linux guest operating system

 New KB (TBD) – Overall Timekeeping document, including Timekeeping


Leads and links to other KBs.

 The official skinny: http://www.vmware.com/pdf/vmware_timekeeping.pdf


Note that this document is VMware’s official position on timekeeping in
VMs and is one of the most regularly updated documents we have. If
there is ever a question, this document is the official source of truth.
Questions?

Vous aimerez peut-être aussi