Wednesday, December 22, 2010

Changing the clock source for Xen HVM domU's

On the last weeks I had noticed a problem with my xen guests that I had not been able to fix until today. The problem was that the time on them was jumping forward !! and in a couple of hours after setting the correct date, the time would be around 45 minutes ahead, even with ntpd running. This obviously created a lot of problems with our applications and servers, for example with subversion, developers could not see the latest changes to projects and Hudson was checking out and building an outdated project version, also having inaccurate info on the servers logs, etc.
The culprit of this was the default clock source Xen uses for HVM domU's (at least with the default version that comes with CentOS 5.5 which is 3.1.2), and I was told on xen-users mailing list that it was highly inaccurate and I should change it. Googling around I found how to do it and it was very simple, just add the following kernel boot params to your domU's to disable the time-stamp counter:
notsc divider=10
Then reboot them, login and adjust the date with the following command:
ntpdate -u 0.centos.pool.ntp.org
You can change the ntp server if you want. Also ensure that the ntpd service is running by issuing the following command:
service ntpd status
If it isn't then start it with:
service ntpd start
And make sure it starts at boot time:
chkconfig ntpd on
Now I have to repeat that on 18 servers :S fortunately there are tools to automate this kind of tasks like puppet or cfengine, which I'm currently looking into to setup in our company.
=-=-=-=-=
Powered by Blogilo

No comments:

Post a Comment