天天看點

VMware虛拟機與Host的時間同步問題

禁止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 秒

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="boolean">false</enabled>  

      </host_time_sync>  

    </components>  

  …… ……  

<integration> <microsoft> then add the following codes <components> <host_time_sync> <enabled type="boolean">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 = "FALSE"

time.synchronize.continue = "FALSE"

time.synchronize.restore = "FALSE"

time.synchronize.resume.disk = "FALSE"

time.synchronize.shrink = "FALSE"

time.synchronize.tools.startup = "FALSE"

## end for 6.5

c) 再次啟動VMware軟體和虛拟機,改一下虛拟機的時間,重新開機一下,OK。

曾有網友推薦進入“虛拟機->控制台->管理工具->服務”禁止VMware Tools Service的方法,也可以吧。

單純地從虛拟機控制台裡的VMware Tool設定中,禁用“将虛拟機與主機作業系統的時間同步”選項,沒有效果。

//測試發現這樣做也是可以不同步時間的。