My server clock / date and time is wrong or drifts
First, determine your instance type.Select options from your Manage Servers screen and look at 'Virtualization type' under Advanced. If it is set to 'Fully Virtualized' follow the HVM instructions below. If it is set to use a PV-GRUB or PyGRUB boot loader use the PV instructions. For Fully Virtualized (HVM) instancesTo resolve this issue, you can change the clocksource on your system. First determine the current clocksource: cat /sys//devices/system/clocksource/clocksource0/current_clocksource tsc We can see that our current clocksource is tsc. To see available clocksources cat /sys/devices/system/clocksource/clocksource0/available_clocksource jiffies pit tsc We can see that we have jiffies, pit, and tsc available as clocksources. To change your clocksource, append clocksource=jiffies to your grub.conf kernel line. The sample grub entry would look like this: title CentOS (2.6.18-194.3.1.el5xen) root (hd0,0) kernel /vmlinuz-2.6.18-194.3.1.el5xen ro root=LABEL=/ console=xvc console=tty clocksource=jiffies initrd /initrd-2.6.18-194.3.1.el5xen.img
cat /sys/devices/system/clocksource/clocksource0/current_clocksource jiffies And it shows us jiffies. If it doesn't, then the kernel clocksource line is not correct. Test and see if drift continues. Depending on your kernel and system pit or jiffies typically resolves any clock drift. For our para-virtualized (PV) instancesIf your server date is incorrect or doesn't "stick" -- ie, you issue the date command and the date resets, do the following as root: echo 1 > /proc/sys/xen/independent_wallclock You can then set the date again. Wait a few moments and confirm the date is correct. echo "xen.independent_wallclock = 1" >> /etc/sysctl.conf Notes
For our para-virtualized "Cloud Kernel" instancesIf you are using a "Cloud Kernel" (Set under options) of your dashboard, you can change your clocksource by modifying the clocksource= line under boot paramaters. If you are facing a clock drift issue, try changing the clocksource= to xen, or a different clocksource if xen is set. Note, once you have made this change you must do a full shutdown of your instance, wait for its state to change to down and then do a start. For x64 CentOS HVM instances that are "jumping ahead"Add notsc divider=10 to your kernel config Example: # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/hda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-164.6.1.el5) root (hd0,0) kernel /vmlinuz-2.6.18-164.6.1.el5 ro root=/dev/VolGroup00/LogVol00 hda=noprobe hdb=noprobe notsc divider=10 initrd /initrd-2.6.18-164.6.1.el5.img title CentOS (2.6.18-164.el5) root (hd0,0) kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-164.el5.img For 32 CentOS HVM instances that are "jumping ahead"Add divider=10 clocksource=acpi_pm to your kernel config Example:# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/hda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-164.6.1.el5) root (hd0,0) kernel /vmlinuz-2.6.18-164.6.1.el5 ro root=/dev/VolGroup00/LogVol00 hda=noprobe hdb=noprobe notsc divider=10 clocksource=acpi_pm initrd /initrd-2.6.18-164.6.1.el5.img title CentOS (2.6.18-164.el5) root (hd0,0) kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-164.el5.img Tweak NTPDEdit your /etc/ntp.conf as follows # grub.conf generated by anaconda tinker panic 0 restrict 127.0.0.1 restrict default kod nomodify notrap server 0.vmware.pool.ntp.org server 1.vmware.pool.ntp.org server 2.vmware.pool.ntp.org driftfile /var/lib/ntp/drift ############## ### It is also important NOT to use the local clock as a time source, often referred to as the Undisciplined Local Clock. NTP has a tendency to fall back to this in preference to the remote servers when there is a large amount of time drift. If you see these two options, comment them as below: #server 127.127.1.0 #fudge 127.127.1.0 stratum 10 ##############Once you have changed the kernel clocksource you need to reboot your machine. |