VMware

威睿是戴爾科技旗下軟體公司,提供雲端運算和硬體虛擬化的軟體和服務,並號稱是第一個成功商業化的虛擬化x86架構。公司成立於1998年,總部設在美國加利福尼亞州帕洛阿爾托。

Import Virtualbox ova Image

Export from Virtualbox

匯出 VM 至一個 *.ova image
  • 格式選 OVF1.0。(非必要)
  • 不要勾選網卡。(建議:在匯入 vmware 以後,再手動新增合適的虛擬網卡)

Import to vSphere 6 Server

  1. 下載 VMware-ovftool: https://www.dropbox.com/s/k925gfb2zn4ffgw/ovftool.zip?dl=0
  2. 將 *.ova 轉換成 OVF 格式(輸出檔案包含有 *.ovf*.mf*.vmdk)
  3. 從 vSphere Web 選擇 Deploy OVF Template,來源必須同時選擇兩個檔案 *.ovf 與 *.vmdk
  4. 使用 vCenter 介面無法完成匯入,必須改用 ESXi 介面。

OVFTool 轉換

"C:\Program Files\VMware\VMware OVF Tool\ovftool.exe" --lax source.ova target.ovf

Deploy OVF template

vSphere ESXi Web)

deploy_ovf-esxi.png

vCenter Web)

deploy_ovf-vcenter.png

F.A.Q

Error: No supported hardware versions

Issues detected with selected template. Details: - -1 : -1:VALUE_ILLEGAL: No supported hardware versions among [virtualbox-2.2]; supported: [vmx-04, vmx-07, vmx-08, vmx-09, vmx-10, vmx-11, vmx-12, vmx-13].

解決:
編輯 *.ovf,找到這一段

<System>
  <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
  <vssd:InstanceID>0</vssd:InstanceID>
  <vssd:VirtualSystemIdentifier>graylog#95</vssd:VirtualSystemIdentifier>
  <vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>
</System>

搜尋 VirtualSystemTypevirtualbox-2.2 改成 vmx-07,存檔後,再匯入一次。

Error: No space left for device ‘7’ on parent controller ‘5’.

Line 85: No space left for device ‘7’ on parent controller ‘5’.
Line 66: Unsupported virtual hardware device ‘AHCI’.

Solution: 更換更高版本的 vmx-?? 試試。

Error: The checksum(s) from the provided manifest file do not match

The checksum(s) from the provided manifest file do not match the content of file(s): zabbix5.ovf.

Solution: 如果修改過 *.ovf ,在匯入時不要選擇 *.mf。

Error: Value ‘‘PIIX4’’ of ResourceSubType element not found in [#]

48:7:VALUE_ILLEGAL: Value ‘‘PIIX4’’ of ResourceSubType element not found in [].
57:7:VALUE_ILLEGAL: Value ‘‘PIIX4’’ of ResourceSubType element not found in [].
85:7:VALUE_ILLEGAL: Value ‘‘5’’ of Parent element does not refer to a ref of type DiskControllerReference.
75:7:VALUE_ILLEGAL: Value ‘‘4’’ of Parent element does not refer to a ref of type DiskControllerReference.

Solution: 不要使用 vCenter 做匯入;改用 ESX Host 的 Web 管理介面。

vmx 版本對應表

  ESX version
vmx-07 ESX 4.0
vmx-10 ESX 5.5
vmx-13 ESX 6.5

Reference

ESXi Bug Fix & Upgrade

升級或更新 ESX 主機步驟

用 SSH 方式

以 SSH Client 登入 vSphere 主機進行軟體修正程序。

NOTE: vSphere 主機必須事先手動啟用 SSH 服務。

上傳更新/升級檔至主機

從官網下載的更新/升級檔 esxi6.5uX-mgmt-bundle-3.4.5-8.zip 上傳到 vSphere 主機的任一個 datastore。

NOTE:
- 不同的 vSphere 版本會有相對應的特定更新/升級檔,必須下載正確的版本。
- zip 檔案不需要解壓縮。
- 升級 ESX 軟體時,不能使用 *.iso 安裝檔

檢查系統版本資訊

vSphere 軟體版本

[root@tpeitpesx-a02:~] esxcli system version get
   Product: VMware ESXi
   Version: 6.5.0
   Build: Releasebuild-10719125
   Update: 2
   Patch: 67

vSphere 安裝紀錄

[root@tpeitpesx-a02:~] esxcli software profile get
(Updated) HPE-ESXi-6.5.0-Update1-iso-650.U1.10.1.3.3
   Name: (Updated) HPE-ESXi-6.5.0-Update1-iso-650.U1.10.1.3.3
   Vendor: Hewlett Packard Enterprise
   Creation Time: 2019-06-14T03:16:25
   Modification Time: 2019-06-14T03:16:35
   Stateless Ready: True
   Description:

      2019-06-14T03:16:25.647136+00:00: The following VIBs are
      installed:
        ilo   650.10.3.0.2-1OEM.650.0.0.4240417
        nmlx4-rdma    3.16.11.6-1OEM.650.0.0.4598673
        scsi-iscsi-linux-92   1.0.0.2-3vmw.650.0.0.4564106
        sata-sata-sil 2.3-4vmw.650.0.0.4564106
        shim-libata-9-2-2-0   6.5.0-0.0.4564106
...
...
      ----------
      HPE Custom Image Profile for ESXi 6.5.0 ISO

   VIBs: amsd 650.11.4.0-18.4240417, ata-libata-92 3.00.9.2-16vmw.650.0.0.4564106, ...

TIP:
- 列出最開始 ISO 的安裝與之後做過的所有更新記錄。
- 如有執行升級,這裡 profile 的版本資訊並不會更新。

檢查更新/升級檔的資訊

上傳目錄: /vmfs/volumes/{your-datastore-name}/{path-to-the-file}

[root@tpeitpesx-a02:~] esxcli software sources vib list -d /vmfs/volumes/LocalDisk/Patches/esxi6.5uX-mgmt-bundle-3.4.
5-8.zip
Name           Version                            Vendor  Creation Date  Acceptance Level  Status
-------------  ---------------------------------  ------  -------------  ----------------  ---------
amsd           650.11.4.5-18.4240417              HPE     2019-07-19     PartnerSupported  Update
fc-enablement  650.3.4.0.10-4240417               HPE     2019-03-12     PartnerSupported  Installed
cru            650.6.5.10.4-1OEM.650.0.0.4240417  HPE     2018-04-04     PartnerSupported  Installed
ilo            650.10.3.0.2-1OEM.650.0.0.4240417  HPE     2018-03-29     PartnerSupported  Installed
smx-provider   650.03.15.00.4-4240417             HPE     2018-08-29     VMwareAccepted    Installed

TIP: 透過這指令可以在**安裝前**,列出那些套件將會被更新。以本次為例,這次更新主要是針對 amsd 套件的 bug 重要修正。
Before: amsd 650.11.4.0-18.4240417
After: amsd 650.11.4.5-18.4240417

安裝更新/升級檔
  1. 關閉或遷移主機上所有的 VMs
  2. 啟用主機的 Maintenance Mode
  3. 開始安裝更新/升級檔
  4. 重啟主機
  5. 關閉主機的 Maintenance Mode
  6. 開啟所有 VMs

啟用/關閉 Maintenance Mode (也可以改用 GUI 操作)

# 啟用
vim-cmd hostsvc/maintenance_mode_enter

# 關閉
vim-cmd hostsvc/maintenance_mode_exit

安裝更新/升級檔

應該要用哪種方式升級,這很難有個絕對答案。比較安全的方式,是用 update;而 install 才會安裝完整最新的套件。對於某些情況下也有可能這兩種方式沒有差異。官方說明參閱 “esxcli software vib” commands to patch an ESXi 6.x/7.x host (2008939) (vmware.com)

esxcli software vib update --dry-run -d "/vmfs/volumes/LocalDisk/Patches/esxi6.5uX-mgmt-bundle-3.4.5-8.zip"
esxcli software vib update -d "/vmfs/volumes/LocalDisk/Patches/esxi6.5uX-mgmt-bundle-3.4.5-8.zip"

esxcli software vib install --dry-run -d "/vmfs/volumes/LocalDisk/Patches/ESXi670U3-18828794-HPE-Gen9plus-depot.zip"
esxcli software vib install -d "/vmfs/volumes/LocalDisk/Patches/ESXi670U3-18828794-HPE-Gen9plus-depot.zip"
更新後的檢查

確認 amsd 更新後的版本號

esxcli software vib list | grep amsd


ESXi Commands

Check whether the /tmp directory is full
vdf | grep tmp
System Module
esxcli system module list
esxcli system module set --enabled=false --module=<module-name>
esxcli system module set --enabled=true --module=<module-name>
手動修改 vmx

經由  OVF 匯入 VM 後,設定裡有音效卡無法移除。必須手動修改 vmx 檔,將以下內容移除:

sound.autoDetect = "TRUE"
sound.virtualDev = "hdaudio"
sound.fileName = "-1"
sound.present = "TRUE"
sound.pciSlotNumber = "35"

手動修改 vmx 檔後,還須執行以下指令更新 VM

# Find the Vmid for the affected VM
vim-cmd vmsvc/getallvms

# Reload configuration for the VM
vim-cmd vmsvc/reload <Vmid-of-VM>
Network
[root@tpeitpexb95:~] esxcli network ip interface list
vmk0
   Name: vmk0
   MAC Address: 80:30:e0:3b:a0:c4
   Enabled: true
   Portset: vSwitch0
   Portgroup: Management Network
   Netstack Instance: defaultTcpipStack
   VDS Name: N/A
   VDS UUID: N/A
   VDS Port: N/A
   VDS Connection: -1
   Opaque Network ID: N/A
   Opaque Network Type: N/A
   External ID: N/A
   MTU: 1500
   TSO MSS: 65535
   RXDispQueue Size: 1
   Port ID: 33554442

vmk1
   Name: vmk1
   MAC Address: 00:50:56:6b:5c:ed
   Enabled: true
   Portset: vSwitch1
   Portgroup: FT1
   Netstack Instance: defaultTcpipStack
   VDS Name: N/A
   VDS UUID: N/A
   VDS Port: N/A
   VDS Connection: -1
   Opaque Network ID: N/A
   Opaque Network Type: N/A
   External ID: N/A
   MTU: 1500
   TSO MSS: 65535
   RXDispQueue Size: 1
   Port ID: 50331654

vmk2
   Name: vmk2
   MAC Address: 00:50:56:62:26:d7
   Enabled: true
   Portset: vSwitch1
   Portgroup: FT2
   Netstack Instance: defaultTcpipStack
   VDS Name: N/A
   VDS UUID: N/A
   VDS Port: N/A
   VDS Connection: -1
   Opaque Network ID: N/A
   Opaque Network Type: N/A
   External ID: N/A
   MTU: 1500
   TSO MSS: 65535
   RXDispQueue Size: 1
   Port ID: 50331655
[root@tpeitpexb95:~] esxcli network ip interface ipv4 get
Name  IPv4 Address   IPv4 Netmask   IPv4 Broadcast   Address Type  Gateway      DHCP DNS
----  -------------  -------------  ---------------  ------------  -----------  --------
vmk0  10.14.1.95     255.255.248.0  10.14.7.255      STATIC        10.14.0.254     false
vmk1  192.168.101.7  255.255.255.0  192.168.101.255  STATIC        0.0.0.0         false
vmk2  192.168.103.7  255.255.255.0  192.168.103.255  STATIC        0.0.0.0         false
[root@tpeitpexb95:~] esxcli network ip route ipv4 list
Network        Netmask        Gateway      Interface  Source
-------------  -------------  -----------  ---------  ------
default        0.0.0.0        10.14.0.254  vmk0       MANUAL
10.14.0.0      255.255.248.0  0.0.0.0      vmk0       MANUAL
192.168.101.0  255.255.255.0  0.0.0.0      vmk1       MANUAL
192.168.103.0  255.255.255.0  0.0.0.0      vmk2       MANUAL



vCenter Patch

官方連結
步驟程序
  1. 下載 Patch file: VMware-vCenter-Server-Appliance-6.7.0.48000-18010531-patch-FP.iso
  2. 上傳 *.iso 到 vCenter VM 可以存取的任一個 datastore 裡 (Recommend: 建立一個 Patches 目錄)
  3. 確認 vCenter VM 在哪一個 ESXi Host
  4. 登入 ESXi Web Admin (NOTE: 這裡不是 vCenter Web)
  5. 將 vCenter VM 關閉
  6. 對 vCenter VM 進行一次快照備份
  7. 重新開啟 vCenter VM
  8. 設定 vCenter VM 掛載這次要 patch 的 iso 檔
  9. 遠端工作電腦以 SSH 登入 vCenter VM
  10. 開始執行系統 Patch 指令
  11. 重啟 vCenter VM 後完成
Patch Commands
# To stage the ISO:
software-packages stage --iso

# To see the staged content:
software-packages list --staged

#To install the staged rpms:
software-packages install --staged


vCenter 管理

忘記 root 密碼

首先,連線到 ESXi 主機的 VMware Host Client,並選擇以網頁瀏覽器或 VMware Remote Console 方式,開啟 vCenter Server Appliance 的 Console 介面。來到「PHOTON」啟動頁面後,按下〔e〕鍵以開啟開機選項。

在「GNU GRUB」命令視窗中,添加 rw init=/bin/bash 命令參數,然後按下〔F10〕鍵繼續啟動系統。

接著,會來到 root 根路徑命令提示字元下,執行 mount -o remount,rw / 命令參數,以完成檔案系統根路徑的掛載。

最後執行 passwd 命令,即可完成 root 密碼的修改。

完成密碼修改後,記得執行 umount / 命令來停止檔案系統的掛載,最後執行 reboot -f 命令參數以便重新啟動 vCenter Server Appliance。

root 密碼到期設定

變更根使用者的密碼及密碼到期設定

vCenter Backup & Restore

這裡的備份不是指 VM snapshot,而是異地備份或者稱為冷備份。

備份工具需使用 VMware Appliance Management Interface (https://<FQDN-of-VCSA>:5480/)。

備份目的支援以下傳輸協定:

系統還原注意事項:

  1. 需要使用相同版本 VCSA ISO 安裝檔。
  2. 還原步驟與初始安裝程序類似,需要有一個 Windows 工作站 (VM 或實體機),而且網路必須與 vCenter 主機 (VCSA) 同一個子網路。
  3. Windows 工作站先掛載 VCSA ISO 檔,執行 vcsa-ui-install/win32/installer.exe 開啟安裝/復原程序。 

教學連結:

vCenter Converter

簡介

VMware vCenter Converter Standalone

Home: https://www.vmware.com/products/converter.html 

安裝

錯誤: Error 1053

Error 1053: The service did not respond to the start or control request in a timely fashion .

解決:參閱 KB: https://kb.vmware.com/s/article/64993 

  1. Click the Start button, then click Run, type regedit, and click OK.
  2. In the Registry Editor, click the registry subkey HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control.
  3. In the details pane, locate the ServicesPipeTimeout entry, right-click that entry and then select Modify.
    Note: If the ServicesPipeTimeout entry does not exist, you must create it by selecting New on the Edit menu, followed by the DWORD Value, then typing ServicesPipeTimeout, and clicking Enter.
  4. Click Decimal, enter the new timeout value in milliseconds, and then click OK.(Modify the value to a larger one. Here is no recommended value,  adjust this value accordingly.)
  5. Restart the computer.
  6. Manual start vCenter Converter Agent/Server/Worker service in Windows Service Manager. If the service is still failed to start with Windows event 7009, increase the "ServicesPipeTimeout" value.