Wednesday, April 15, 2009

Change/Sync Harware clock with NTP on ESX host

My few hosts are spread across Australia it has major issue with H/W clock and local clock.
[root@xxxx]# hwclock --show
Sun 28 Sep 2008 10:03:23 PM EST -0.804718 seconds
[root@xxxx]# date
Wed Apr 15 22:33:50 EST 2009

In order to fix it use following command

hwclock --systohc –localtime

I cannot resist to cut and paste the following from this url

1. Make sure /etc/sysconfig/clock has the proper settings. For me this is:
ZONE="America/Chicago"
UTC=false
ARC=false
This modification properly sets the system during the boot process in the init scripts.
2.Run the following command:
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime

Substitute "America/Chicago" for the proper time zone setting. When you run the date command, you should now see your time presented with the correct timezone "indicator"

[root@SMHESX01 root]# date
Tue Jun 21 23:45:03 CDT 2005

3. Set your hardware clock to match the current time:
hwclock --systohc --localtime

4. Verify hardware clock with:
hwclock --show
Tue Jun 21 23:49:36 2005 0.956810 seconds

You can change to any time zone I want using this method and the time/date change based on timezone configured.

5. You may also want to toss the following in for good measure:
ntpdate ntpserver.domain.com

No comments: