Sunday, February 19, 2012

Adjusting ESX host Time Zone


ESX

 
To change the time zone:
 
Note: It is not necessary to reboot the ESX host after following this procedure.
  1. Log into the ESX service console as root.
  2. Find the desired time zone under the directory /usr/share/zoneinfo . Some regions have multiple files in a subdirectory. For example, US contains several files, each representing a time zone.

    Note: The example below uses
     /usr/share/zoneinfo/US/Pacific as the new time zone file.
  3. Use nano ( or another text editor) to open /etc/sysconfig/clock . At the command prompt, type:
    nano /etc/sysconfig/clock

    Edit this file to show the relative path to the file representing the new time zone, and ensure that UTC and ARC are set as shown:ZONE="US/Pacific" 
    UTC=false
    ARC=false
  4. Copy or link the desired time zone file to /etc/localtime . Continuing the example using US/Pacific :
    • To copy, run:
      cp /usr/share/zoneinfo/US/Pacific /etc/localtime
    • To link, run:
      ln -s
       /usr/share/zoneinfo/US/Pacific /etc/localtime 

      Note: If you receive a overwrite `/etc/localtime'? prompt, answer y to replace the file representing the old time zone. Again, it is not necessary to reboot the ESX host after updating/etc/localtime .
  5. Confirm that /etc/localtime has been updated with the correct zoneinfo data:
    1. Reference the zoneinfo file used in step 2 and compare it to / etc/localtime using the diff command:[root@esxhost]# diff /etc/localtime /usr/share/zoneinfo/US/Pacific
      If the files are identical, your prompt returns without any output.
    2. If /etc/localtime is not the same as the /usr/share/zoneinfo/ , the output from the diff command appears similar to:Binary files /etc/localtime and /usr/share/zoneinfo/US/Pacific differ 

      If the files are not the same, repeat step 4.
After updating /etc/localtime with the correct zoneinfo data, confirm the system and hardware clocks are correct. Use the Linux date command to check and set the correct time if necessary. Set the hardware clock to match the correct system time:
  1. Set the system clock to the local date and time:
    date MMDDhhmmYYYY
  2. Update the hardware clock with current time of the system clock:
    /sbin/hwclock --systohc
Notes:
  • Upon booting, ESX runs /etc/rc.d/init.d , which reads /etc/sysconfig/clock to set the system clock based on the hardware clock's current time and the configured time zone information. To synchronize ESX to an external time reference, see Installing and Configuring NTP on an ESX host (1339) .
  • You may be required to restart the vSphere Client for the timezone information to be updated within the GUI.
For more information about timezones, including issues with Daylight Saving Time (DST), see the VMware Knowledge Base.
 

ESXi

 
ESXi uses UTC time and does not support changing time zones.
 
In ESXi 3.5, you see the message:
Note: The date and time of the host have been translated to the local time of this VI Client.
In ESXi 4.0, you see the message:
Note: The date and time of the host have been translated to the local time of this vSphere Client.
In ESXi 4.1, you see the message:
Note: The date and time of the host have been translated to the local time of this vSphere Client.