How to change & set Data and time on Citrix Xen VM

Setting time on a Virtual Machine is always a painful tasks. Different virtualization platform have different techniques of setting time like in Virtuozzo you can change the Timezone of the VM but you can’t set time as it synchronize the time from the host server.

On a Citrix Xen VM also the clocks synchronized to the time running on the host server, and cannot be independently changed. So, when you try to set time (using date -s command) on a Xen VM it will show that the command is executed but it won’t change the time. You can see that in following

root@user [/home]# date -s “Mon Jun 13 15:33:40 IST 2011”
Mon Jun 13 15:33:40 IST 2011
root@user [/home]# date
Tue Jun 28 15:39:01 IST 2011

To change the time on a VM you need to enable independent clock settings of the VM which is disabled by default which you can see using following command.

root@user [/home]# cat /proc/sys/xen/independent_wallclock
root@user [/home]#

Output of the above command is “0” which shows that independent clock settings for the VM is disabled. Now use following command to enable it

root@user [/home]#echo 1 >> /proc/sys/xen/independent_wallclock

and verify if its enabled or not

root@user [/home]# cat /proc/sys/xen/independent_wallclock
root@user [/home]#

Now try to set the date and time using date –set or date -s command.

root@user [/home]# date –set=”13 June 2011 15:33:00″
Mon Jun 13 15:33:00 IST 2011
root@user [/home]# date
Mon Jun 13 15:33:03 IST 2011
root@user [/home]#


About: Mike

Milind Koyande loves to work on new technologies specially virtualization and troubleshoot server problems. I’m an avid photographer and love to spend my free time close to nature, trying to capture its glory on my camera.

One thought on “How to change & set Data and time on Citrix Xen VM”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.