How to un-swap lot´s of VMs

Immagine there is a situation where DRS had to stuff too much VMs on a single host. This will cause host swapping and ballooning to happen and thus your VMs being super slow or not reacting at all.

There is an undocumented command within each ESXi that you can use to trigger unswap for a single world documented here in great detail. I have memory pages swapped, can vSphere unswap them? | Yellow Bricks (yellow-bricks.com)

To unswap all VMs on one host at once you can use this single line:

esxcli vm process list | grep -i 'World ID:' | awk '{print "localcli --plugin-dir=/usr/lib/vmware/esxcli/int vm process unswap -w", $3}' | sh

Saved us a bunch of time after one of these DRS mishaps…

Leave a Reply