设为首页 收藏本站
查看: 1128|回复: 0

[经验分享] VMware虚拟机与Host的时间同步问题

[复制链接]
发表于 2018-6-6 18:10:21 | 显示全部楼层 |阅读模式
  禁止VMware虚拟机与Host的时间同步
  
1. 查看虚拟机是否安装了 VMware Tools, 如果有安装,则将 VMware Tools 属性窗口的“选项”-->“其他选项”中“虚拟机与宿主机操作系统时间同步(T)”前面的勾去掉,点击确定。
2. 关闭虚拟机(是关机,而非休眠),关闭 VMware Workstation。
3. 查看宿主机中的服务中是否有名称为 “VMware Tools Service” 的服务,如果有,则禁用该服务。
4. 用记事本打开 .vmx 文件,如“F:/My Virtual Machines/Red Hat Enterprise Linux 4/Red Hat Enterprise Linux 4.vmx”
5. 将如下配置项的值改为 FALSE
[javascript]view plaincopyprint?
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"  
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"  
6. 如果需要设置虚拟机的启动时间,则修改配置项 rtc.startTime 的值,该配置项的值是从 1970 年 1 月 1 日 0 时 0 分 0 秒到当前时间的秒数。
  如,将 rtc.startTime 的值设置为 1218182888 后,重新启动虚拟机时,虚拟机的时间将被设置为 2008 年 8 月 8 日 8 时 8 分 8 秒
[javascript]view plaincopyprint?
rtc.startTime = 1218182888  
rtc.startTime = 1218182888
可以通过这个网址将某个时间转换为 UNIX 时间戳:
http://www.onlineconversion.com/unix_time.htm
7. 运行 VMware Workstation,启动虚拟机。
附 1:如果是 virtual pc 2007,则用记事本打开 .vmc 文件(virtual pc 2007 的配置文件),将 <host_time_sync> 下 <enabled> 的值改为 false,如:
[xhtml]view plaincopyprint?
<integration>  
  <microsoft>  
    then add the following codes  
    <components>  
      <host_time_sync>  
        <enabled type=&quot;boolean&quot;>false</enabled>  
      </host_time_sync>  
    </components>  
  …… ……  
<integration> <microsoft> then add the following codes <components> <host_time_sync> <enabled type=&quot;boolean&quot;>false</enabled> </host_time_sync> </components> …… ……  

  附 2:对 .vmx 文件中修改的几个配置项的说明(参考于 http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf 第 17 页):
tools.syncTimeIf set to TRUE, the clock syncs periodically.time.synchronize.continue If set to TRUE, the clock syncs after taking a snapshot. time.synchronize.restore If set to TRUE, the clock syncs after reverting to a snapshot. time.synchronize.resume.disk If set to TRUE, the clock syncs after resuming from suspend and after migrating to a new host using the VMware vMotion feature. time.synchronize.shrink If set to TRUE, the clock syncs after defragmenting a virtual disk. time.synchronize.tools.startup If set to TRUE, the clock syncs when the tools daemon.

    以下内容参考于 http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf 第 8 页
     You can also force the CMOS TOD clock to start at a specified time whenever the virtual machine is powered on, independent of the real time. To do this, set the configuration file option rtc.startTime. The value you specify is in seconds since Jan 1, 1970 00:00 UTC, but it is converted to the local time zone of the host operating system before setting the CMOS TOD clock (under the assumption that the guest operating system requires the CMOS TOD clock to read in local time). If your guest operating system is running the CMOS TOD clock in UTC or some other time zone, you should correct for this when setting rtc.startTime
============================================================

  
  另一则:
  如何禁止VMware虚拟机与Host的时间同步功能
用VMware安装的Windows 2000/XP/2003虚拟机,要是实现跟主机的时间同步,这个比较简单,安装上VMware Tools就可以了。以后每次启动虚拟机系统后,时间就会自动与主机的时间同步了。但是如何让虚拟机的时间与Host不同步呢?

  在VMware 6.5中的操作如下:
  a) 关闭虚拟机和VMware软件。
  b) 打开虚拟机的配置文件 (.vmx) ,并添加或修改下列选项的值为FALSE,注意要用文本编辑器编辑。
  ## tools configuration for vm 6.5
  tools.syncTime = &quot;FALSE&quot;
  time.synchronize.continue = &quot;FALSE&quot;
  time.synchronize.restore = &quot;FALSE&quot;
  time.synchronize.resume.disk = &quot;FALSE&quot;
  time.synchronize.shrink = &quot;FALSE&quot;
  time.synchronize.tools.startup = &quot;FALSE&quot;
  ## end for 6.5
  c) 再次启动VMware软件和虚拟机,改一下虚拟机的时间,重启一下,OK。
  曾有网友推荐进入“虚拟机->控制面板->管理工具->服务”禁止VMware Tools Service的方法,也可以吧。
  单纯地从虚拟机控制面板里的VMware Tool设置中,禁用“将虚拟机与主机操作系统的时间同步”选项,没有效果。
  //测试发现这样做也是可以不同步时间的。
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-519642-1-1.html 上篇帖子: VNC连接linux下vmware虚拟机win 下篇帖子: VMWare View 5使用RDP连接正常,用PCoIP连接失败
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表