By default, the swap file is created in the same location as the virtual machine's configuration file, which could either be on a VMFS datastore or a vSAN datastore. On a vSAN datastore, the swap file is created as a separate vSAN object.

By default, swapfiles for a virtual machine are located on a datastore in the folder that contains the other virtual machine files. However, you can instead configure the hosts in your cluster to place virtual machine swapfiles on an alternative datastore of your choice.

If a host fails, and that host had running virtual machines that were using swap files, those swap files continue to exist and consume many gigabytes of disk space. You can delete the swap files to eliminate this problem.