Linux : Guest VM time sync with Xen host

By | March 2, 2014

It’s possible to tell the kernel of your Xen guest VM to synchronize or not the clock with the physical host machine. There are numerous reason why you would or not to use this feature (such as your guest VM is behind or forward the clock over time).

To find out the current setting, simply do the following command :

cat /proc/sys/xen/independent_wallclock

0 =  The clock will NOT be sync with the host.
1 = The clock will be  sync with the host.

Whatever setting you want to apply, issue the following command to apply the desired setting :

sysctl -w xen.independent_wallclock=<VALUE>

(Replace <VALUE> either with “0” or “1” depending if you want to enable or not the independent clock on this VM.)

This setting won’t survive to the next reboot. To apply permanently, edit your sysctl file :

/etc/sysctl.conf

Add add :

xen.independent_wallclock = <VALUE>