Symptoms

 Purpose
Virtual machines running on an ESXi host uses a swap file (vswap) for any memory that is not reserved. This swap file is used when the virtual machine is unable to allocate physical memory from the ESXi host. In larger environments this can increase the storage usage to provide multiple virtual machines with vswap space.

 Resolution
Configuring a memory reservation on the virtual machine will change the size of the required vswap file. These are some examples of the vswap file size changes that occur when changing the virtual machines reserved memory.

Note: The virtual machine must be powered off for the vswap file size when changing the memory reservation.

Virtual Machine with no Memory Reservation
In this example, the virtual machine has no reservation and the vswap file size is the size of the allocated memory to the virtual machine.
Virtual Machine with 50% Memory Reservation


In this example, the virtual machine has 50% of its allocated memory reserved, reducing the vswap file to the remaining 50% that is not reserved.
Virtual Machine with 100% Memory Reservation
In this example, the virtual machine has 100% of its allocated memory reserved, this will reduce the vswap file to needing no storage space

Note: There is a second vswap file created with the prefix vmx that is the swap file for the overhead memory reserved for the VMX process.
To disable the vswap file for the VMX process:
  1. In the vSphere Web Client, power off the virtual machine.
  2. Right-click the virtual machine and click Edit Settings.
  3. Click the VM Options tab and expand Advanced.
  4. Click Edit Configuration.
  5. Click Add Row.
  6. Enter the name sched.swap.vmxSwapEnabled.
  7. Enter the Value false.
  8. Click OK.