Don't wish your life away - Linux virtualized on Hyper-V gains time 
As we roll out more and more virtualized environments, including our own (all of the in-house servers at Technica are virtual machines running on Microsoft Hyper-V), we come across tweaks that make an engineer's job easier.

We started to virtualize some of the servers in one of our hosting centres and found that BlueOnyx, a CentOS Linux hosting platform that we use for hosting some clients' sites, gained hours per day, due to the way that the guest OS responds to the virtualized clock.

The official Microsoft solution is to add

clock=pit

to the kernel lines in the grub start-up file called menu.lst
As you might have guessed, this made no difference at all to the time drift.

We found eventually that the proper solution is as follows:

Add to the end of each kernel line in /boot/grub/menu.lst
(remember to including the kernel line you will find in the comments at the top, so that new kernels inherit the argument)
this string:

processor.max_cstate=1 clock=pmtmr divider=10

You may also want to update the Linux OS's clock with a trusted time source weekly.
We do this by editing root's crontab:

crontab -e (allows you to edit crontab in vi)

# update clock every Sun at 13:00
0 13 * * 0 /usr/sbin/ntpdate -s -b -u pool.ntp.org
# sync hardware clock 5 mins later
5 13 * * 0 /sbin/hwclock –-systohc

We hope this little snippet from our in-house knowledge-base helps a few of you who find yourself stuck in the same position.

If you have need for Virtualization consultancy or advice, please feel free to get in touch.

Jason Ozin is a well-known IT professional, technical architect and joint owner of Technica Solutions - www.technicasolutions.co.uk. Jason consults leading UK and international enterprises on real world technical and IT issues. Jason specialises in business infrastructure and IT security matters.

[ add comment ] ( 199 views )   |  [ 0 trackbacks ]   |  permalink

<Back | 1 | 2 | Next> Last>>