I have installed Vmware tools 4 linux vms and enabled time sychronisation
But i couldnt find all the time of 4 vms are same when i fired the "date" command.
Please help me !
VMwareLinuxUnix OS
Last Comment
Duncan Roe
8/22/2022 - Mon
that1guy15
I have been fighting my ESX server for about a year with time sync on linux vm's and have been unsuccessful with with vmtools. I ended up creating a script that ran ntpdate every hour to keep my linux servers in sync.
I would be interested to know a resolve for this too.
jaisonshereen
ASKER
Will it be this the cause ?
You can synchronize the time in the guest operating system with time on the host operating system only when the time in the guest operating system is earlier than the time set in the host.
You will need to install ntpdate on your linux box. you can then either run the command ntpdate or do what i did a create a script that you place in cron to run at a regular interval.
You will then need to find a reliable ntp server. Search the net and you will find them everywhere
jaisonshereen
ASKER
Can u give me an IP ? i couldn't find it in net ..
where/how i can install ntpdate ?
so after install i execute this command ..
ntpdate in all servers.
Will all the servers become sync?
Time synchronization inside a virtual environment can be tricky. By using VMware Tools it will only catchup time if the VM time is too slow.
Using a scheduled ntpdate might be good enough, depending on how precise timing you need inside your VM.
Lowering the HZ of your kernel will usually help quite a bit for fixing the clock inside your VM. Using the following parameters (for 32bit guests) will also help: clocksource=pit noapic nolapic nosmp
You do not mention what linux distros you're using. For precise timing you might want to use the VMware Descheduled time service (you need a supported guest os): http://www.vmware.com/pdf/vi3_esx_vmdesched.pdf
I had the problem of VMWare clock running fast at work. It's all fine now; the solution is in 2 parts:
1. Disable VMWare tools' attempts to fix the time - it only make it worse
2. Refresh the time every minute from a "reasonably" accurate source (standard PC running Linux as native O/S)
Item 1 requires that you have or obtain a binary editor. Edit the VNMWare daemon executable, replacing every occurrence of "settimeofday" with "gettmeofday". The 2 functions have identical signatures so the code keeps running, it just stops messing up your time.
Item 2 is implemented by having a once per minute cron job run netdate (available from http://linux.maruhn.com/sec/netdate.html). Only give netdate a single host name on its command line, so it has no option but to get time from that host.
Do that on all your 4 systems and they should stay in sync.
jaisonshereen
ASKER
For Item 1 : Can i go ahead an uninstall vmware tools ?
For Item 2 : Please help me . Please explain me in detail
i can see lots of rpm netdate files ..which one i have to use ?
jaisonshereen
ASKER
Will this be a solution?
Vmware Time Sync
If you want to completely disable time synchronization in the guest, open the virtual machine's configuration file (.vmx) in a text editor and set the following options to FALSE.
If instead you want the guest to have a constant offset from real time as maintained by the host, you can use the rtc.diffFromUTC option, or simply set the CMOS TOD clock time from the virtual machine's BIOS setup screen or from within the guest operating system. In Microsoft Windows, setting the system time automatically updates the CMOS clock.
If you want, you can force the CMOS TOD clock's offset to be initialized to a specific value at power on. To do so, set the option rtc.diffFromUTC in the virtual machine's .vmx configuration file to a value in seconds. For example, setting rtc.diffFromUTC = 0 sets the clock to UTC at power on, while setting rtc.diffFromUTC = -25200 sets it to Pacific Daylight Time, seven hours earlier than UTC. The guest operating system can still change the offset value after power on by writing directly to the CMOS RT
and ..moreover editing these values ..will not make any harm ..right?
larstr
You should only add those kernel parameters inside your guest OS. If your kernel is 2.6.17 or newer you should use clocksource instead of clock even though clock is still working in many distros.
Changing timer.max.hardperiod will help your too quick guests if you can't lower their HZ which is the optimal solution. We still don't know what linux distros you're using, but some of the later RHEL editions have kernels where you can lower the HZ easily without recompiling the kernel by using the kernel parameter divider=10.
My solution does not rely on any cooperation from VMWare. We had a commercial deadline to meet, and we could not afford to await possible answers. The host, by the way, is Windows XP.
The netdate URL I gave you is for source: you build and install yourself. We run Slackware so had it anyway. I can't check the crontab entry right now because I'm off work for a few weeks following radical prostatectomy but from memory it looks like:
* * * * * /usr/sbin/netdate linuxhost 1>/dev/null
In this example, "linuxhost" is the name of some PC running linux native. The guests will sync their time to whatever it is on that PC. Windows systems don't offer that service (on port 37) so that's why you have to use linux. linuxhost might run ntpd - nothing else needs to.
You should run "crontab -e" as root and insert this line.
I can't advise you on which RPM to use as I hardly ever use them myself. But I guess anything with i386 in its name will probably be OK.
Quite possibly the suggestion to change the config file in http:#22083782 will work for you instead of editing the executable as I did. You can check if this has worked as follows:
Install the cron netdate line. Now keep an eye on the time for a few minutes: in an xterm or other shell window type "watch :". You will see the time ticking over every 2 seconds in the top right hand corner of the window. Make sure it changes smoothly: you may see the odd correction as the minute changes (because netdate ran) but if the time jumps around at other times then VMWare daemon is still messing with it.
Good luck and post if you have any further queries
Duncan Roe
Some new posts while I was typing. You need an RPM with x86_64 in its name instead of i386 (you may not have the 32-bit glibc libraries installed to run i386 binaries - I have them on my 64-bit system but after a lot of manual installation). Building from source will always work (providing you have the compiler toolchain installed).
Duncan Roe
Note the solution I posted will work for slower or faster guest.
Sorry jaisonshereen, I don't understand what you mean by "ticking using mouse click". "watch" is a standard command to repeat *any* shell command every 2 seconds (you can vary that time - 2s is just the default). So I could have suggested you do "watch date" - but watch always displays the time anyway so I suggested "watch :": ":" is the shell no-op command.
Just follow my previous suggestions and everything will be fine. I have found the drift is too big for any other mechanism to cope.
I would be interested to know a resolve for this too.