Increase VMware VM performance by placing the Swap file in an alternate location – ESX/ESXi 5.0

In this post you will see how to Increase VMware VM performance by placing the Swap file. By default, a swap file is created when a virtual machine is powered ON under a ESXi host. Swap files normally are stored in the same location as in the VM’s configuration file, it could be a VMFS datastore or a vSAN datastore. Swap file location can give a big leap to the VM performance provided it is configured appropriately.

If the host disk array is slow and is running a bunch of virtual machines coherently could lead to a serious performance degradation, especially when they are all swapping.

Hence, it would be best advised to have a dedicated data store whereby the swap files are stored in an alternate location to increase the performance of the Virtual machines.

Swap file location of a VM can be changed when you observe the following over a period,

  • Guest operating system failure.
  • Stop errors.
  • Read-only file system.
  • VM lag during resource intensive operations-high I/O.

Steps to edit the virtual machine swap file location in ESX/ESXi 5.0

  1. Connect to the Vsphere client.
  2. Click the Configuration tab for ESXi/ESX host and then Click “Virtual Machine Swapfile
    and finally click Edit.
  3. Clicking edit will let you specify the datastore where you would want to store the virtual machine
    swap files.
  4. Virtual machines are to be restarted to complete the action.
  5. Verify if the swap file is now created under the new location after reboot.

Steps to edit the swap file location for a sing virtual machine in ESX/ESXi host 5.0

  1. Turn off the Virtual machine.
  2. Unregister the virtual machine and Remove from Inventory.
  3. Connect to the host via SSH client.
  4. Change the directory to the folder where the virtual machine resides:          “cd/vmfs/volumes/datastore_name/virtual_machine_folder/”
  5. Append this line “sched.swap.dir = /vmfs/volumes/datastore/” in the virtual machine’s configuration file using a text editor.
  6. Re-register the virtual macine.

Vmotion comptability

During VM migration, if the swap file location is default or a customer one in the destination host which differs from the swap file location defined in the source host, the swap file will be copied to the new location resulting in slower migrations with vMotion.

Hope increasing VMware VM performance in an alternate location was informative.

Here is a related post you maybe interested in: Steps to be taken when a VM goes in Read-only mode.

To get updates follow us on Facebook, Twitter, LinkedIn

Subscribe to get free blog content to your Inbox

Written by actsupp-r0cks