--- tags: - "\U0001F6A9purpose/\U0001F4DDlist" - "\U0001F6A9purpose/ℹ️documentation" - "⭐topic/\U0001F4BEsoftware/vmware" --- # ESXi maintenance cheatsheet This document was written targeting ESXi 6 and 7. Newer/older versions may differ. ESPECIALLY NOW THAT BROADCOM BOUGHT VMWARE AND DESTROYED ALL HISTORIC LINKS EPIC # Command shortlist | category | what happen | what to do | | ------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **universal** | esxcli doesn't work? | `localcli` | | **universal** | maintenance mode | `esxcli system maintenanceMode set --enable=` | | **universal** | enable tools ramdisk (always for sdcard installs) | `esxcli system settings advanced set -o /UserVars/ToolsRamdisk -i 1`
[ESXi 7.0 U2a Potentially Killing USB and SD drives!](https://vninja.net/2021/05/18/esxi-7.0-u2a-killing-usb-and.sd-drives/)
[ESXi 7.0 SD Card/USB Drive Issue Temporary Workaround](https://vninja.net/2021/06/01/esxi-7.0-sd-card-issue-temporary-workaround/) | | **storage** | change scratch dir (contains persistent logs, vibs, tempfiles) | `esxcli system settings advanced set -o /ScratchConfig/ConfiguredScratchLocation -s /vmfs/...`
see also [Manually setting a scratch location for ESXi in the vSphere Client appears to succeed but the setting is not honored (2003678)](https://kb.vmware.com/s/article/2003678) | | **storage** | list all storage devices | `esxcfg-mpath -b` | | **storage** | list all mounted filesystems | `esxcli storage filesystem list` | | **storage** | list diagnostic partitions | `esxcli system coredump partition list` | | **storage** | list all partitions on a disk | `partedUtil getptbl DISK` | | **vmfs** | view info about mounted vmfs | `vmkfstools -P /PATH` | | **vmfs** | mount vmfs | `esxcli storage filesystem mount` | | **vmfs** | umount vmfs | `esxcli storage filesystem unmount` | | **ramdisk** | mount ramdisk | `esxcli system visorfs ramdisk add` | | **ramdisk** | umount ramdisk | `esxcli system visorfs ramdisk remove` | | **EFI boot** | fsck fat | `dosfsck` | | **update** | update software patch level | `esxcli software profile update -p ESXi-7.0U1c-17325551-standard -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml`
locate patch version at [https://my.vmware.com/group/vmware/patch](https://my.vmware.com/group/vmware/patch) | # check fat partitions ```shell for x in scratch bootbank altbootbank store; do x=/$x echo "============ testing $x ============" if [ ! -e $x ]; then echo "$x does not exist" continue fi y=$(vmkfstools -P /$x 2>/dev/null | grep -oE "^\s(.*)$" | sed 's/\t//') if [ "x$y" = xmemory ]; then echo "$x is ramdisk" continue fi z="dosfsck -nv /dev/disks/$y | tail +3" echo "# $z" eval $z done ``` # delete broken files on FAT volumes ~~[Bad file descriptor during update - VMware Technology Network VMTN](https://communities.vmware.com/t5/ESXi-Discussions/Bad-file-descriptor-during-update/m-p/2613344/highlight/true#M246535)~~ [Wayback Machine](https://web.archive.org/web/20220524222722/[https://communities.vmware.com:443/t5/ESXi-Discussions/Bad-file-descriptor-during-update/m-p/2613340?start=0&tstart=0#M246535)](https://communities.vmware.com:443/t5/ESXi-Discussions/Bad-file-descriptor-during-update/m-p/2613340?start=0&tstart=0#M246535)) # recreate store partition ```shell # format partition. disk may change, partition should be 8 vmkfstools -C vfat /dev/disks/mpx.vmhba0:C0:T0:L0:8 # link new vol to store ln -sfn /vmfs/volumes/GUID /store # reinstall tools, point it at your zip or vib esxcli software vib install -d /vmfs/volumes/myvol/VMware-Tools-VERSION-core-offline-depot-ESXi-all-FILEID.zip ``` # default partition scheme | id | name | mount | size | optional | description | | ---:| --------------- | -------------------- | ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------ | | 1 | `systemPartition` | | 4 MB | | contains EFI bootloader | | 2 | `linuxNative` | `/scratch` | 4 GB | ✔️ | persistent storage to hold output of vm-support and other misc tasks. if not present, `vm-support` will save to ramdisk | | 3 | VMFS datastore | `/vmfs/volumes/GUID` | rest of disk | ✔️ | default datastore created on install if backing medium is not flash memory | | 5 | `linuxNative` | `/bootbank` | 250 MB | | stores all compressed system files and drivers. ESXi image is stored here in `s.v00` | | 6 | `linuxNative` | `/altbootbank` | 250 MB | | last known-good installation of ESXi, copied from 5 after a successful upgrade. use Shift+R when booting to boot from this partition | | 7 | `vmkDiagnostic` | | 110 MB | | In case of ESXi Crash or PSOD, host dump file written on this partition | | 8 | `linuxNative` | `/store` | 286 MB | | contains VMware Tools ISOs and floppy images. can be configured to hold logs and other data but doesn’t by default | | 9 | `vmkDiagnostic` | | 2.5 GB | | larger partition as backup for 7 | # enable HTTP outgoing firewall exclusion for wget ```shell esxcli network firewall ruleset set --enabled=true --ruleset-id=httpClient ``` verify: ```shell esxcli network firewall ruleset list | grep -E '^Name|^-|http' ``` # update tools manually via console `wget` into `/vmimages` (should be a softlink somewhere under `/store`) [stable ESXi base releases](https://packages.vmware.com/tools/esx/latest/) [latest releases](https://packages.vmware.com/tools/releases/latest/) (these do still work after Broadcom buyout as of 2024-05-18) # common files | where it be | what it do | | ------------------------------------- | ------------------------------------------------------------ | | `/etc/vmware/esx.conf` | storage, network and hardware config | | `/etc/vmware/hostd/authorization.xml` | vCenter to ESXi host connection authorization | | `/etc/vmware/vpxa/vpxa.cfg` | vCenter and ESXi connectivity | | `/etc/vmware/vmkiscsid/iscsid.conf` | iSCSI daemon config | | `/etc/vmware/fdm` | FDM config file with clusterconfig, hostlist and VM metadata | | `/etc/vmware/license.cfg` | license info | | `/etc/vmware/hostd/vmInventory.xml` | info about VMs on host | | `/tmp/stagebootbank` | staged updates before remediation |