i want to create a vmdk file within the the ESX host, currently it creates the vmdk (virtual disks) on the datastore which is mounted from SAN storage.

my idea is to tell esx to use that vmdk so that i can use that as a swap file.

Currently swap files are accessed over the datastore from SAN which i think is the factor for the slow performance.

i am running vmware esx 4.1

any suggestions? how the swap files for all virtual machines be created on the local esx host??


According to VMWare it's done like this:

To edit the virtual machine swap file location in ESX/ESXi 3.5 and 4.x:

  1. Connect directly to your host or to your vCenter Server using the VMware Infrastructure/vSphere Client.
  2. Click the Configuration tab for the ESX host.
  3. Click Virtual Machine Swapfile Location and click Edit.
  4. Specify the datastore where you want to store the virtual machine swap files.
  5. After restarting your virtual machines, ensure the swap file is located on the specified host datastore.

As a side note, did you look at the memory usage and swap file graphics before assuming it's the root of your problem?

If possible, simply adding more RAM to the VM should help more than changing the swap file location.


From the vSphere Resource Management Guide: (note the hit to vMotion performance in the 2nd bullet if that is a concern for you).

Swap File Location

By default, the swap file is created in the same location as the virtual machine's configuration file. A swap file is created by the ESX/ESXi host when a virtual machine is powered on. If this file cannot be created, the virtual machine cannot power on. Instead of accepting the default, you can also:

  • Use per-virtual machine configuration options to change the datastore to another shared storage location.
  • Use host-local swap, which allows you to specify a datastore stored locally on the host. This allows you to swap at a per-host level, saving space on the SAN. However, it can lead to a slight degradation in performance for VMware vMotion because pages swapped to a local swap file on the source host must be transferred across the network to the destination host.

That being said/referenced, are you sure the SAN link is the bottleneck for you? or the swap file usage? ESX will generally only use swap files if it absolutely has to. If your host is not memory over-committed then it will probably never use them. If your host IS memory over-committed then a better solution would be to add more memory or move some VMs to other hosts (if you have them). There are a myriad of reasons why you might be having slow performance depending on your exact setup, but the swap file location is not very likely to be one of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.