顯示具有 VM 標籤的文章。 顯示所有文章
顯示具有 VM 標籤的文章。 顯示所有文章

2023年11月14日 星期二

Hyper-V Replica

Reference:
 
設定 Hyper-V Replica 必須有 https 憑證。
自己產生憑證的指令(10年有效期):
New-SelfSignedCertificate -DnsName "hostname" -CertStoreLocation "cert:\LocalMachine\My" -TestRoot -NotAfter (Get-Date).AddMonths(120)

狀況:
來源主機 BLADE-33,目的主機 BLADE-38
(注意) 目的主機的Windows版本必須 大於/等於 來源主機

步驟:
  • 在 BLADE-33, BLADE-38 各自產生憑證。將中繼憑證 CertReq Test Root 複製到 受信任的根憑證。

2021年9月28日 星期二

Hyper-V VM 壓縮

Reference:
 
用 PowerShell Script 比較省事, 請參考以下指令照順序做就可以了

$VHDx = "D:\Hyper-V\Virtual Hard Disks\Disk.vhdx"
mount-vhd -path $VHDx -readonly
optimize-vhd -path $VHDx -mode full
dismount-vhd -path $VHDx
optimize-vhd -path $VHDx -mode full

需要注意的是 OS 必須有 Hyper-V Role 才有能力執行 optimize-vhd
如果只是裝了 Hyper-V Management Feature 是不行執行 Compact 的

2021年1月19日 星期二

Hyper-V 實體檔案壓縮

 Reference:

Complete Guide on How to Shrink and Compact Virtual Hard Disks in Hyper-V

Hyper-V可以壓縮實體檔案放出沒用到的空間,但要先關閉VM。實測200GB壓縮後為182GB。從VM查看使用了120GB,還有不少空間放不掉。





2018年12月25日 星期二

Sparc Solaris on QEMU

Reference:
Running Solaris 2.6 (sparc) on qemu-system-sparc in Linux x86_64 (Mint 19)
QEMU on Linux hosts
Documentation/Platforms/SPARC
Solaris/sparc under qemu how-to
QEMU how to setup Tun/Tap + bridge networking
Configuring Guest Networking
QEMU/Networking
[Linux KVM] Linux KVM concept - Networking

QEMU 可以模擬其他種類的 CPU。
實測可以模擬 Sparc,但是 Sparc64 還做不出來。
模擬 Sparc CPU 我只做出 SunStation 5,測試其他機型也做不出來....

主要步驟:
  1. 安裝 CentOS 7.6
  2. 安裝 QEMU 3.1
  3. 透過 QEMU 安裝 Solaris
  4. 設定 CentOS network bridge 讓 Solaris 連外
  5. 啟動 Solaris

2018年6月9日 星期六

VMware Replication 6.1 Error “no element found: line 1, column 0”

Reference:
Registering replication appliance to vCenter fails with “no element found: line 1, column 0”

開啟 Replication Appliance Console,登入。
cd /opt/vmware/etc/vami/
ls -l
檢查 ovfenv.xml,如果檔案大小是 0:關機,登入 vsphere web client,開機。


2018年5月23日 星期三

VMware VDP status read only

Reference:
Backup Cannot be performed while VDP Server is in Admin state

狀況:
在 vCenter 管理網頁中看到 VDP 狀態變成 read only

解法:
1. 用 putty 進入 VDP console
2. 執行 dpnctl status 確認 gsan 狀態是 degraded
3. 執行 dpnctl start gsan
4. 執行 sync;sync;reboot (會等很久,重新開機後狀態就恢復為 normal)

2018年1月19日 星期五

Solaris Sparc 模擬軟體 on x86

Reference:
simics虚拟机 + solaris 9 sparc系统 for memory compiler

需求:
有部分舊的軟體必須在 Sun Sparc CPU 上執行,但現在只能找二手機器,如果找廠商維護費用高。

解法:
在 x86 CPU 硬體上安裝 Simics 模擬軟體,可以模擬出 Sparc CPU 安裝 Solaris。

安裝步驟:
1. 在 Windows 7 上安裝 Simics (安裝時提示要裝 WinPcap 3.0,但建議裝 4.x)
2. 將 Solaris 9 的 ISO 檔放到 C:\Users\admin\Virtutech Simics\workspace\targets\sunfire
3. 開啟 Simics,用 New Session 分三次打開 workspace\targets\sunfire 的
        peanut-sol9-cd-install1
        peanut-sol9-cd-install2
        peanut-sol9-cd-install3
    安裝 Solaris 9 完成。
4. 啟動安裝好的系統
    New Session 選 workspace\targets\sunfire\peanut-common.simics 就可以了

2017年1月15日 星期日

VMware 升級到 ESXi 5.5 後 guest OS 無法啟動的解法

狀況:
ESXi 5.1 升級到 5.5,guest OS 無法啟動

錯誤訊息:
Host 'x.x.x.x' is not compatible with the vSphere Replication configuration supported by the virtual machine : the configured RPO is lower than what the host can support.

解法:
  • Shut down the virtual machine.
  • ssh to the host where the Virtual machine is located (look at the vm summary tab in the general section)
  • Locate the virtual machine's files in the datastore.
  • Backup the virtual machine's configuration file (.vmx) If your edits break the virtual machine, you can roll back to the original version of the file.
  • Edit the virtual machine's configuration file (.vmx) to comment out the following lines; prefixing them with a '#' character.
hbr_filter.configGen = ""
hbr_filter.rpo = ""
hbr_filter.destination = ""
hbr_filter.port = "0"
hbr_filter.gid = ""
hbr_filter.protocol = ""
hbr_filter.quiesce = "true"
hbr_filter.opp = "true"
hbr_filter.pause = "true"
scsi0:0.hbr_filter.rdid = ""
scsi0:0.hbr_filter.persistent = ""
  • Save the file
  • Run vim-cmd vmsvc/getallvms | grep -i <VM Name> to find the vmid. 
  • Then Run vim-cmd vmsvc/reload <vmid found above> to reload the virtual machine into inventory. 
  • See Reloading a vmx file without removing the virtual machine from inventory (1026043) for more details.
  • Power on the virtual machine

Reference:

Windows PPTP server on VMware ESXi5.5

昨天將 VMware ESXi 5.1 升級到 5.5,發現 Windows PPTP server 無法連線,錯誤訊息 619。

幸好查到這篇解法 Point-to-Point Tunneling Protocol (PPTP) connections may not work on ESXi 5.5,將 PPTP server 網路卡改為 vmxnet3 即可。

2017年1月4日 星期三

How to register/add a VM to the Inventory in vCenter Server

Reference:
How to register/add a VM to the Inventory in vCenter Server

如果需要把 VM 加回 ESXi host 或 vCenter,步驟如下:

  1. Open the vSphere/VMware Infrastructure (VI) Client and log in with appropriate credentials.
  2. If connecting to vCenter Server, click on the desired host.
  3. Click the Configuration tab.
  4. Click Storage.
  5. Right-click on the appropriate datastore and click Browse Datastore.
  6. Navigate to the folder named after the virtual machine, and locate the virtual machine.vmx file.
  7. Right-click the .vmx file and click Add to inventory. The Add to Inventory wizard opens.
  8. Continue to follow the wizard to add the virtual machine.


2017年1月3日 星期二

VMware ESXi 5.1 guest disk 2TB

VMware ESXi 5.1 的 guest OS disk 可以設定為 2TB,但是搭配 vCenter 5.1, Replication 5.1 做 Replication 時會發生錯誤,造成 guest OS 關機無法啟動。
VMware Knowledge base: Cannot power on a virtual machine after enabling vSphere Replication (2057808)
恢復 guest OS 的方法:VMware Module DevicePowerOn power on failed Unable to create virtual SCSI device for scsi0:1

Try 1: 把 vCenter, Replication 升級到 5.5、ESXi 在 5.1,錯誤狀況相同
Try 2: 把 vCenter, Replication 升級到 6.0、ESXi 在 5.1,錯誤狀況相同
Try 3: 把這個 guest OS 做 clone,錯誤訊息為超過檔案大小
Try 4: 把 vCenter, Replication 升級到 6.0、ESXi 升級到 5.5,Replication 可以正常運做了

結論:
ESXi 5.1 的 guest OS disk 設定為 2TB 可以使用,但是 Replication 和 clone 時會發生錯誤,必須升級到 5.5 才會正常。

2016年12月30日 星期五

VMware vCenter 6.0 + Replication 6.1 install


Reference:

安裝 vCenter 6.0 步驟
  1. 在 DNS server 設定 vcenter 的 IP, hostname 對應 (Ex: vcenter60)
  2. 用 Daemon Tool Lite 掛載 VMware-VCSA-all-6.0.0.iso 為光碟
  3. 安裝光碟中的 vcsa\VMware-ClientIntegrationPlugin-6.0.0.exe
  4. 用 Chrome 開啟光碟中的 vcsa-setup.html,選擇 Install
  5. 安裝完成後用 administrator@vsphere.local 登入 VMware vSphere Client 或 web client https://vcenter60
安裝 Replication 6.1
  1. 用 Daemon Tool Lite 掛載 VMware-vSphere_Replication-6.1.0.iso 為光碟
  2. 登入 VMware vSphere Client 或 web client https://vcenter60
  3. Deploy OVF Template 時選擇光碟的 bin\vSphere_Replication_OVF10.ovf
  4. 安裝完成後,登入 https://IP_address_of_appliance:5480
  5. 用 VMware vSphere Client 設定 Datacenter 的 IP pool。如果沒有設定,啟動 vSphere Replication Appliance 會有錯誤訊息 Cannot initialize property 'vami.netmask0.vSphere_Replication_Appliance'. Network 'port group' has no associated network protocol profile.
  6. 到 Configuration 裡面按 Save and Restart Service。如果有錯誤訊息 Error applying startup configuration: Server returned 'request expired' less than 0 seconds after request was issued, but it shouldn't have expired for at least 600 seconds.,請將 ESXi host, vCenter 6.0, Replication 6.1 的時間設定為一致。
  7. 完成後到 vCenter web client 就可以看到 vSphere Replication

如果啟動 vSphere Replication Appliance 有錯誤訊息 

2016年12月22日 星期四

VMware ESXi 5.1 to 5.5

本來想要把 5.1 直接升到 6.0,但是升級 vcenter 時卡住,只好先到 5.5。

步驟:

2016年9月22日 星期四

CentOS DHCP problem on VMware Workstation 12

狀況:
在 VMware Workstation 12 安裝了虛擬的 CentOS,無法自動取得 IP address。

解法:
在 Virtual Network Editor 按 Restore Default。

Reference:
Networking is broken in my VMware 10.0 VMs after upgrading to Windows 8.1

2016年5月20日 星期五

VMware ESXi 5.x host experiences a purple diagnostic screen mentioning E1000PollRxRing and E1000DevRx

狀況:
安裝 Skype server 2015,user logon 時造成整台機器出現紫色畫面當機。

原因:
VMware ESXi 5.x 的虛擬網路卡 E1000E 有 bug。

解法:
安裝 VMware 更新檔
VMware ESXi 5.x host experiences a purple diagnostic screen mentioning E1000PollRxRing and E1000DevRx

因為安裝更新檔必須整台機器重開機,如果暫時不方便重開機,可以改用虛擬網路卡 VMXNET3。



2016年2月14日 星期日

VMware Module DevicePowerOn power on failed Unable to create virtual SCSI device for scsi0:1

收到 mail 通知有一台在 VMware 上的 Windows server 備份失敗,用 VMware vSphere Client 檢查發現是 server 狀況是關機。

啟動這一台 VM guest 時出現錯誤訊息:
Module DevicePowerOn power on failed Unable to create virtual SCSI device for scsi0:1

用 Google 找到這一篇,但它是 import VM 發生的錯誤。

我的做法:
  1. 編輯 VM guest 設定,將第二個硬碟移除
  2. 用 SSH 連到 VM host,切換到 VM guest 的目錄,將 hbr-persistent-state-RDID-xxxxxxx.psf 移到其他目錄
  3. 編輯 VM guest 設定,將 VMDK 加回去
這樣 VM guest 就可以開機了!

回想可能的原因:
昨天設定這一台 VM host 的 Replication,可能複製到另一個 VM host 時發生錯誤,造成 VMDK 檔案狀態卡住。

2015年7月9日 星期四

VMware Replicating a virtual machine fails

Error: VR server has no hosts through which to access destination datastore

Environment:
VMware ESXi 5.1
vCenter (install via OVF Template)
vSphere Replication Appliance (install via OVF Template and use Embedded vSphere Replication Database)

Reference::
Replicating a virtual machine fails with the error: VR server localhost.localdom has no hosts through which to access destination datastore (2032571)
Connecting to vPostgres Databases
How do I list all databases and tables using psql?

Solution:
1. login vSphere Replication Appliance with account root (using putty)
2. su - vrmsdb
3. psql
4. \connect vrmsdb
5. Run this query to determine if any hosts are marked as Unsupported:
  • To query hosts that are not associated with a VR server:
select * from HostEntity h where state=4 and not exists (select * from HbrHostEntity where h.vcMoId=HbrHostEntity.vcHost_vcMoId);
  • To query hosts that are associated with a VR server:
select * from HostEntity h where state=4 and exists (select * from HbrHostEntity where h.vcMoId=HbrHostEntity.vcHost_vcMoId);
This query returns a host ID. You can use the vCenter MOB to identify the host using the host ID.

6. Run this query to perform a cleanup:
  • To clean up Unsupported records for hosts that are not associated with a VR server:
delete from HostEntity where state=4 and not exists (select * from HbrHostEntity where vcMoId=HbrHostEntity.vcHost_vcMoId);

  • To change the state of hosts that are tagged as Unsupported and associated with a VR server to ACTIVE:
update HostEntity set state=1 where state=4 and exists (select * from HbrHostEntity where vcMoId=HbrHostEntity.vcHost_vcMoId);

7. Restart vSphere Replication Appliance at the Recovery site.
8. setup replication configuration for the VM guest again.

Possible Cause:
VMware host upgrade from ESX 4.x to 5.1. (I think)

2015年5月5日 星期二

VirtualBox 4.3 VM auto start on CentOS host

需求:CentOS 開機時將 VM 自動開機

做法:
vi /etc/rc3.d/S99local
/usr/bin/vboxmanage startvm "VM name" --type headless

Reference:
VBoxHeadless, the remote desktop server

用這種 VM 開機方式在 VM VirtualBox Manager 上只能 preview,沒辦法進去 VM 操作。
必須另外安裝 VirtualBox Extension Pack 才能用 RDP 進入操作。

VirtualBox Extension Pack 安裝指令
vboxmanage extpack install <.vbox-extpack>

在 VM 的 Remote Display 設定 server port,Ex: 5000。

用 RDP client 連線,這時要連 CentOS host IP + server port。
Ex: mstsc.exe CentOS_host_IP:5000