Ubuntu – Best practice for system clock sync on KVM host

kvm-virtualizationntpntpdUbuntuvirtualization

I have an Ubuntu 9.10 server running as a KVM host with ntpd installed on it. The host system has the correct system time. At the moment I only have a single KVM guest, also Ubuntu 9.10 server. I do not have ntpd installed on it, and I just discovered the clock is about 6 minutes slow. It wasn't that way when it was installed about a month ago.

I thought that I only needed to keep the host clock synchronized and that the guests used the host clock. But maybe that is a memory from using OpenVZ. I believe the reasoning was related to only the host could modify the physical system clock.

Is running ntpd on both the host and all the guests the correct thing to do? Or is there something else that is preferred? How should I keep the guest clocks in sync?

Best Answer

Check what clocksource that you are using:

$ cat /sys/devices/system/clocksource/clocksource0/current_clocksource

Check which ones that are available:

$ cat /sys/devices/system/clocksource/clocksource0/available_clocksource

If you got a "kvm-clock" entry in "available_clocksource" try to use it by setting kernel parameter:

clocksource=kvm-clock

Pretty good document here (general) why it's so tricky to get the clock right.

Related Topic