Upgrade a standalone esxi host

With an Internet connected standalone ESXi host you can use the well known esxcli method to patch the host directly from the VMware Online Depot:
Enable SSH access on your host, log in to it (e.g. using putty) and run the following commands:

# open firewall for outgoing http requests:

esxcli network firewall ruleset set -e true -r httpClient

# View available ESXi Image Profiles

esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

# Update using the ESXi Imageprofile from the VMware Online depot

esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p "type the name of the imageprofile here"

# Reboot your host

reboot

Zero free space using SDelete to shrink Thin Provisioned VMDK

Some things should be simple, shrinking a thin provisioned virtual disk should be one of them, it’s not. N.B. This will just reduce the VMDK’s usage on the VMFS datastore NOT resize the “provisioned size” of a thin disk. To shrink a VMDK we can use an ESX command line tool “vmkfstools”, but first you have to zero out any free space on your thin provisioned disk. On Windows guests we can use the

sysinternals tool SDelete (replace the [DRIVE:] with the relevant Windows drive letter) you must use v1.6 or later!:

sdelete.exe -z [DRIVE:]

This will fill any unused space on the drive specified with zero-blocks.

Caution: This operation will expand your thin-disk to its maximum size, ensure your datastore has the capacity to do this before you run this operation. As of v1.6 -c and -z have changed meanings, many instructions say -c zeros free space, this is no longer the case, it zeros the space then fills with random data in accordance with DOD spec: DOD 5220.22-M, the trigger to zero space with 0x00 has changed to -z! On linux guests use:

dd if=/dev/zero of=/[PATH]/zeroes bs=4096 && rm -f /[PATH]/zeroes

Again, replace

[PATH] with the relevant path to a location on the target storage device. Next we will shut down the guest OS and SSH into the ESX shell, once in the shell we need to navigate to the VMDK’s datastore -> directory and we’ll check the VM’s actual size:

du -h [DISKNAME].vmdk

Punch all zeroed blocks out of the VMDK:

vmkfstools --punchzero [DISKNAME].vmdk

Check the size again (will now be less):

du -h [DISKNAME].vmdk

Of course, replace

[DISKNAME] with your VMDK’s actual name. There we have it, all that free space, now reclaimed.

 

Stolen from: http://www.mylesgray.com/infrastructure/zero-free-space-using-sdelete-shrink-thin-provisioned-vmdk/