# VMware vSphere [TOC] - 原先 vSphere 桌面版(C#) client 端只支援到版本5.5、6.0,在這之後 HTML5 Web Client 取而代之成為 vSphere client. ## Snapshot - A kind of version control for VMs. - Type of Backup - Full Backup - Differential Backup - Incremental Backup > [What's the difference between differential and incremental backups (and why should I care)?](https://www.acronis.com/en-us/articles/incremental-differential-backups/) - Ref - [VMware虛擬化環境的快照管理](https://www.ithome.com.tw/tech/74422) - [VMware doc - Snapshot Files](https://docs.vmware.com/en/VMware-vSphere/5.5/com.vmware.vsphere.vm_admin.doc/GUID-38F4D574-ADE7-4B80-AEAB-7EC502A379F4.html) --- ## Lockdown mode - Prevents remote users from logging directly into the host. ### ESXi 5.1 - In version 5.1, there was no lockdown mode setting in Vsphere Client interface for manager to configure. But you can disable SSH and ESXi shell at **local console**. - Customize System -->**Troubleshooting Mode Options** - Disable SSH - Disable ESXi shell ### Newer version which support vSphere Web Client --- ## Commands in ESXi shell ### `vim-cmd` - for each VM - List VMs ```shell= vim-cmd vmsvc/getallvms ``` ``` Vmid Name File Guest OS Version Annotation 3 NagiosFreeBSD13 [datastore1] NagiosFreeBSD13/NagiosFreeBSD13.vmx freebsd64Guest vmx-08 4 CompNetBSD [datastore1] CompNetBSD/CompNetBSD.vmx otherGuest64 vmx-08 5 CompOpenBSD [datastore1] CompOpenBSD/CompOpenBSD.vmx otherGuest64 vmx-08 ``` - **Power on** the VM ```shell= vim-cmd vmsvc/power.on [vmid] ``` - **Power off** the VM ```shell= vim-cmd vmsvc/power.off [vmid] ``` - **List summary status** from the VM ```shell= vim-cmd vmsvc/get.summary [vmid] ``` - **Creat Snapshot** ```shell= vim-cmd vmsvc/snapshot.create ``` - **Revert** to a snapshot ```shell= vim-cmd vmsvc/snapshot.revert [vmid] ``` - Manually register a VM ```shell= vim-cmd solo/registervm ``` - Unregister VM ```shell= vim-cmd vmsvc/unregister ``` - Install VMware Tool on a VM ```shell= vim-cmd vmsvc/tools.install [vmid] ``` ### `esxcli` - for global op on VM host > `esxcli` is a script written in Python that is located in the /sbin/ directory. - Information about all running VMs ```shell= esxcli vm process list ``` ``` CompOpenBSD World ID: 72452 Process ID: 0 VMX Cartel ID: 72451 UUID: 56 4d 0a e4 0b 15 d7 66-07 1b 40 82 50 5e 28 4b Display Name: CompOpenBSD Config File: /vmfs/volumes/616a4e3a-989d4ea7-2366-90e2ba6d97e0/CompOpenBSD/CompOpenBSD.vmx CompNetBSD World ID: 66560 Process ID: 0 VMX Cartel ID: 66541 UUID: 56 4d 3b 39 f1 cd 0c 3e-9e 3c d3 28 2d 71 0f 27 Display Name: CompNetBSD Config File: /vmfs/volumes/616a4e3a-989d4ea7-2366-90e2ba6d97e0/CompNetBSD/CompNetBSD.vmx NagiosFreeBSD13 World ID: 54867 Process ID: 0 VMX Cartel ID: 54866 UUID: 56 4d dd 3d 65 6e 1c b3-a6 6d 6c fb 6e da af 47 Display Name: NagiosFreeBSD13 Config File: /vmfs/volumes/616a4e3a-989d4ea7-2366-90e2ba6d97e0/NagiosFreeBSD13/NagiosFreeBSD13.vmx ``` - Kill the VM process ```shell= esxcli vm process kill --type=[soft,hard,force] --world-id=[WorldID] ``` ### Others (ex. network) - Get/set VM host's network interface ```shell= esxcli network ip interface list esxcli network ip interface ipv4 get esxcfg-route ``` - NIC status ```shell= esxcfg-nics -l ``` - List tasks ```shell= vim-cmd vimsvc/task_list ``` --- ## Crobjob in ESXi - In ESXi shell, it has the same concept of crontab setting. But there is no command `crontab` for managers to use. - Here we need to edit the file ==/var/spool/cron/crontabs/root== ```shell= cat /var/spool/cron/crontabs/root ``` ``` #min hour day mon dow command 1 1 * * * /sbin/tmpwatch.py 1 * * * * /sbin/auto-backup.sh 0 * * * * /usr/lib/vmware/vmksummary/log-heartbeat.py */5 * * * * /sbin/hostd-probe ``` > In ESXi, you **should** add `sh` before the shell script you want to execute. For example, > ```shell= > sh /tmp/testdate.sh > ``` - After editing this file, **restart the crond service** in order to make the changes take effect. ```shell= cat /var/run/crond.pid kill [pid of crond] /usr/lib/vmware/busybox/bin/busybox crond ``` --- ## Time Zone - In ESXi, the default time zone would be set to **UTF+0**, and we couldn't change it directly in ESXi shell. - In order to fit the local date and time, configure it in vSphere Client. ![](https://i.imgur.com/ZStyQSt.png) - [ESX and ESXi host time keeping Best Practices (2004453)](https://kb.vmware.com/s/article/2004453) --- ## vCenter - [Download](https://customerconnect.vmware.com/downloads/details?downloadGroup=VCL-VSP510-VC-51U2A&productId=285&rPId=6238&download=true&fileId=31a4dd296e6c9a81595515ade0b1df2f&uuId=ae42180b-3549-4888-a840-e3335332f9f6) > - [vSphere OVA安裝方式](https://www.nakivo.com/cn/vsphere-ova%E5%AE%89%E8%A3%9D%E6%96%B9%E5%BC%8F/) > - [How to install and configure vCenter Server Appliance 5.1 on ESXi 5.1](https://www.youtube.com/watch?v=4_puxzgmX9c&ab_channel=PaulBraren) - [url to my vCenter Web Insterface](https://10.21.22.188:5480/) > Default login: root/vmware ### vMotion ![](https://i.imgur.com/aGi5zuu.png) - To enable vMotion and/or Fault tolerance logging: 1. Log into vCenter Server using the vSphere Client. 2. Click the ESXi/ESX host. 3. Click the Configuration tab. 4. Under the Hardware section, click Networking. 5. Click Properties for the virtual switch where a VMkernel port has been configured. 6. In the dialog box that opens, select vmkernel in the Ports tab and click Edit. 7. To enable vMotion, select Enabled next to vMotion and click OK. 8. To enable Fault tolerance logging, select Enabled next to Fault tolerance logging and click OK. - ["The virtual machine requires hardware features that are unsupported or disabled on the target host" when migrating a virtual machine](https://kb.vmware.com/s/article/65151) ### Issue ![](https://i.imgur.com/XUNcDgI.png) - [Error:Unexpected character '' (code 65279 / 0xfeff) in prolog; expected '<' at [row,col {unknown-source}]: [1,1] pop up error in C# windows vSphere client](https://communities.vmware.com/t5/ESXi-Discussions/Error-Unexpected-character-code-65279-0xfeff-in-prolog-expected/td-p/493626) - [VMware vSphere client 5.1 installaton on Windows 10 issue](http://blog.pragbits.com/it/2015/09/07/vsphere-client-install-windows10/) --- ## Reference ### Official - [Download VMware vSphere Hypervisor (ESXi)](https://customerconnect.vmware.com/en/downloads/info/slug/datacenter_cloud_infrastructure/vmware_vsphere_hypervisor_esxi/6_5#product_downloads) - [Get licences - VMware vSphere Hypervisor 5 Download Center](https://customerconnect.vmware.com/en/group/vmware/evalcenter?p=free-esxi5) > Home/Evaluate VMware Products/VMware vSphere Hypervisor/Download > JN48K-D2192-48W40-0R1R2-84Y7L ### Article - [Useful commands in ESXi shell](https://xdeath.tw/read.php?6) - [Scheduling Tasks in ESXi Using Cron](https://vswitchzero.com/2021/02/17/scheduling-tasks-in-esxi-using-cron/) ### Else - [Installation of ESXi 6.5](https://ithelp.ithome.com.tw/articles/10184288) - [Installation of ESXi 6.7](https://www.netadmin.com.tw/netadmin/zh-tw/feature/0F96E1DDBD5F4C11BDA57147386662B4?page=4) - [vMotion between 6.5 and 6.7](https://server.vpnwp.com/vmware/vmotion-between-6-5-and-6-7/)