VMware Communities
Zeeffe
Contributor
Contributor
Jump to solution

Freeze date when VM is suspended

Hi,

Is there a way to stop the time of the guest virtual machine from continuously running when put in suspend? I would like the virtual machine will start from the same time when it was suspended. The vmware tools was removed and windows time sync was disabled to stop time from auto updating.

For example: the time of the virtual machine was set to 1st Jan 2000, and suspended. After one day, when i start the virtual machine again, the time will automatically change to 2nd Jan 2000. In there a way to keep the date of the virtual machine at 1st Jan 2000, when recover it on the second day.

Thanks a lot!

0 Kudos
1 Solution

Accepted Solutions
TheBobkin
Champion
Champion
Jump to solution

Hello Zeeffe

Okay, so I did a bit of testing and the following appears to do the job in making the time lag (ONLY with the addition of the last line):

tools.syncTime = "FALSE"

time.synchronize.continue = "FALSE"

time.synchronize.restore = "FALSE"

time.synchronize.resume.disk = "FALSE"

time.synchronize.shrink = "FALSE"

time.synchronize.tools.startup = "FALSE"

time.synchronize.tools.enable = "FALSE"

time.synchronize.resume.host = "FALSE"

isolation.tools.getTime.disable = "TRUE"

However, this only seems to works for suspend and not power-on power-off which syncs the time.

Only tested this on a CentOS7 box so unsure if Windows might react the same but worth a try. (And on Workstation 14, so change the "FALSE" to "0" and "TRUE" to "1" accordingly)

On the off-chance you aren't familiar with using vi/nano to edit .vmx and using the GUI here is a brief:

https://kb.vmware.com/s/article/1020302

Bob

View solution in original post

0 Kudos
8 Replies
daphnissov
Immortal
Immortal
Jump to solution

No, this is how the system is supposed to work. What is your use case for wanting this in the first place?

0 Kudos
Zeeffe
Contributor
Contributor
Jump to solution

we have a funny project to count the total time cost, and it will span a long period with many intervals. the best way we think will be using the timer of windows, and suspend it when the project is not running.

0 Kudos
daphnissov
Immortal
Immortal
Jump to solution

A better approach to this might be a script which has a timer that looks at the power state on the VM rather than from inside the guest. You could even do something like this with PowerShell where it sums all the time the VM spent in the powered on state and not the suspended or powered off state.

0 Kudos
Zeeffe
Contributor
Contributor
Jump to solution

just thought this should be a small script setting in the .vmx file, as there are so many useful time options to set of vmware.

0 Kudos
TheBobkin
Champion
Champion
Jump to solution

Hello Zeeffe

Welcome to Communities! Some useful info on participating here:

https://communities.vmware.com/docs/DOC-12286

If I understand your goal here, you *should* be able to disable synchronisation between guest OS and ESXi by disabling the necessary default configurations for VMware Tools:

https://kb.vmware.com/s/article/1189

The linking article is as old as rocks but goes into this in more detail:

https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/techpaper/Timekeeping-In-VirtualMa...

It may just be as simple as setting tools.syncTime = "0" so try this first and check.

If the above kb settings don't achieve what you are trying to do here I would advise giving continuum a shout, he is truly hardcore into configuring .vmx:

http://sanbarrow.com/vmx/vmx-advanced.html#vmx

FYI: you appear to have posted this question in the incorrect sub-forum - this one is for queries about VMTN Communities itself as far as I am aware.

Bob

0 Kudos
Zeeffe
Contributor
Contributor
Jump to solution

Thanks, Bob!

I have tried tools.syncTime = "0", and this is not the setting i am expecting. tools.syncTime is basically sync the current host time to the client virtual machine. what i want is to stop the clock of client virtual machine running when suspended.

0 Kudos
TheBobkin
Champion
Champion
Jump to solution

Hello Zeeffe

Okay, so I did a bit of testing and the following appears to do the job in making the time lag (ONLY with the addition of the last line):

tools.syncTime = "FALSE"

time.synchronize.continue = "FALSE"

time.synchronize.restore = "FALSE"

time.synchronize.resume.disk = "FALSE"

time.synchronize.shrink = "FALSE"

time.synchronize.tools.startup = "FALSE"

time.synchronize.tools.enable = "FALSE"

time.synchronize.resume.host = "FALSE"

isolation.tools.getTime.disable = "TRUE"

However, this only seems to works for suspend and not power-on power-off which syncs the time.

Only tested this on a CentOS7 box so unsure if Windows might react the same but worth a try. (And on Workstation 14, so change the "FALSE" to "0" and "TRUE" to "1" accordingly)

On the off-chance you aren't familiar with using vi/nano to edit .vmx and using the GUI here is a brief:

https://kb.vmware.com/s/article/1020302

Bob

0 Kudos
Zeeffe
Contributor
Contributor
Jump to solution

Thanks, Bob! that's exactly what i want!

0 Kudos