Best practice for system clock sync on KVM host
Solution 1
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.
Solution 2
Solution 3
A chrony instance per VM with short interval poll updates from local NTP server(s) seems to be the only viable-reasonable way to go.
Although chrony can broadcast time updates across LAN, it doesn't support listening to such updates and there're no plans to add it. Unicast is recommended with such a comment: "…
Even with very modest hardware, an NTP server can serve time to hundreds of thousands of clients using the ordinary client/server mode.
…"
Related videos on Youtube
Comments
-
Tauren over 1 year
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?
-
Tauren about 14 years@rkthkr: looks like current_clocksource is already set to kvm-clock, but the guest is still minutes off from the host.
-
delimiter69 almost 6 yearsGiven that this comment is 8 years old,I don't really trust it it still truly an issue.