1

I'm running KVM w/ centos 6.x.

My guest vm clocks are booting with a 1-2 second lag from their host. My clocksource for the host is ntp. My clocksource for the guest is "kvm-clock", but I need to run ntpd on the guest as well.

It takes roughly 3 minutes for ntpd to correct the time after boot. I'll see this in /var/log/messages

ntpd[1512]: time reset +1.217409 s

But, by this time, our application has already started and it doesn't handle the 1-2 sec time jump very well.

Is this clock difference between the host/guest normal? Is there a way to force the ntpd to set the time earlier in the boot process?

slm
  • 7,615
  • 16
  • 56
  • 76
timeout
  • 11
  • 2

1 Answers1

1

If your application requires the clock to be synced, add ntp-wait to its init script before it is started. Usage is simple, but here is the man page.

EDIT: If you want to sync time as quickly as possible when booting the VM, before starting ntpd as a daemon, run sntp as explained in the documentation for Deprecating ntpdate.

sciurus
  • 12,678
  • 2
  • 31
  • 49
  • that would work, however it takes ~3 minutes for ntpd to synchronize... which is a really long time. – timeout Apr 23 '13 at 16:07
  • This comment about sync time might be helpful for you. http://lists.ntp.org/pipermail/questions/2006-November/012096.html – sciurus Apr 24 '13 at 01:10