Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 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.

share|improve this answer
    
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. lists.ntp.org/pipermail/questions/2006-November/012096.html –  sciurus Apr 24 '13 at 1:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.