Higher than expected datastore usage due to large VM swap files.
search cancel

Higher than expected datastore usage due to large VM swap files.

book

Article ID: 342554

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vSphere ESXi 8.0 VMware Cloud Foundation

Issue/Introduction

  • Unexpectedly high storage usage on datastores housing virtual machines.

  • A significant amount of datastore capacity consumed by Virtual machine swap (.vswp) files.

Environment

VMware vSphere ESXi 8.x
VMware vSphere ESX 9.x

Cause

  • Virtual machines running on an ESXi host create a .vswp file for any configured memory that is not reserved.
  • This file acts as a fallback when the VM is unable to allocate physical memory directly from the host.

  • In environments where VMs have particularly large memory requirements but no reservations, these .vswp files can consume a large amount of datastore capacity.

Resolution

  • Configuring a memory reservation on the virtual machine will change the size of the required vswap file.

  • vSwap Size = (VM Configured Memory) - (VM Memory Reservation)
  • 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.
ReservationConfigured Memory .vswap File Size
0% (Default)16 GB16 GB
50%16 GB8 GB
100%16 GB0 bytes
 
 
Virtual Machine with no Memory Reservation:
 
  • In this example, the virtual machine has no memory reservation. As a result, the .vswp file size is equal to the VM's total allocated memory.
 
 
 
 
 
Virtual Machine with 50% Memory Reservation:
 
  • In this example, the virtual machine has 50% of its provisioned memory reserved. As a result, the .vswp file size is reduced to match the remaining 50% of unreserved memory.
 
 
 
 
 
 
Virtual Machine with 100% Memory Reservation:
  • In this example, the virtual machine has 100% of its provisioned memory reserved. As a result, the .vswp file size is reduced to zero bytes, consuming no datastore space.
 
 
  • Before configuring memory reservations, consider the impact on cluster capacity and storage.

  • Reserving 100% of VM memory eliminates overcommitment but requires careful management.

  • If all VMs have 100% reservations, a vSphere Administrator may be unable to power on additional VMs once the total reserved memory meets the cluster's physical limit, even if actual utilization is low.

Additional Information