How to disable time sync in a VMWare guest?
Solution 1
If you are running VM tools, the tool has an option to periodically sync the time with the host.
If in your path:
vmware-toolbox-cmd timesync status
to view and
vmware-toolbox-cmd timesync disable
to stop it.
Of course any non-vm method of time sync could be there as well. If the system starts ntpd
, it may be syncing that way. You could run ntpd -q
to see if the system responds with associations. If so, it will probably sync with them. You'd then want to disable ntpd
.
Solution 2
It is possible that some NTP service is still running on your system.
Try
chkconfig --list ntpdate
and
chkconfig --list ntpd
It is also possible that ntpdate is called after some other event. You can try to uninstall NTP (ntpdate, ntpd) from the guest machine to disable it completely.
Solution 3
This is on ESX so may not apply. Using vSphere Client:
Click on VM > Edit Settigns > Options Tab > VMware Tools
In the right on the bottom it could be possible that in the Advanced block the Synchronize guest time with host setting is checked. Uncheck this setting.
This bothered me a long time because I thought the OS on the VM kept syncing and I couldn't figure it out. It turned out that this was outside the host and was being done by ESX.
Solution 4
The guest may continue to sync time when certain actions like snapshots are taken/removed - regardless if you disable it in the vmtools client. You can disable it fully in the VMX file. See this KB:
Related videos on Youtube
michael
Updated on September 18, 2022Comments
-
michael over 1 year
I have a desktop (centos 6) that has a VM guest (RedHat 5.5).
I just try to set the date to past time in VM guest. And it works.
However, after 50 minutes, the time is sync to current time.
After I check with the cron job, I did not find any cron job to do the time sync.
May I know how can I disable the time sync in the VM guest?
Edited: I am using virsh to start and stop VM guest.
-
Ludwig Schulze almost 10 yearsAre you using KVM? or something else?
-
Gilles 'SO- stop being evil' almost 10 yearsWhich VM technology are you using? KVM? VMware? LXC? VirtualBox? OpenVZ? Xen? …
-
pqnet almost 10 yearsI think virtual machines have an emulated hardware clock, which is basically proxying to the real hardware clock. Not sure if it is possible for them to be out of sync with the host machine
-
slm almost 10 yearsSee this article: rogierm.redbee.nl/blog/2011/11/07/…
-
-
michael almost 10 yearsI am using virsh to start and stop VM guest. Is the command above still valid?
-
BowlOfRed almost 10 yearsDoesn't matter how it's started. Just matters if it is a vmware guest and if vmware tools have been installed (and are running) inside the guest.
-
BowlOfRed almost 10 years@michael, I thought your question was specific to VM, but realize you could just be asking about general sync. Added NTP check to the answer.
-
VSB over 3 yearsThis is the only one working for me. In addition to this, I need to stop NTP service in my guest OS (CentoOS) using
systemctl stop chronyd
to avoid sync with the network time.