Every time a VM is started a swapfile is created on the datastore where the VM resides.

The format for these files are .vswp

The extra vswp files had a different ending, and that was vswp.xxxxx, where the x’s represent a number.

These files are created when your ESXi hosts crash and when the VM was restarted, the file was still there so it’s renamed and a new .vswp file is created.

For an active VMware environment, you could potentially see a lot of these if you had some ESXi crashing on you in the past. For that environment (around 60 VMs)  I found 34 GB of “dead” .vswp files. That’s a lot when your Datastores are at full capacity.

Using this little piece of code:

dir vmstores:\ -Recurse -Include *.vswp.* | Selectame,Folderpath

This will give you a output of:

Note: This will take a lot of time to run on bigger environments.

 

Advertisements