(cache)"Unable to create a swap file. The value of 'sched.swap.dir' specified in the VM's configuration file is invalid" error in ESXi 5.0 host (2119464) | VMware KB Language :

"Unable to create a swap file. The value of 'sched.swap.dir' specified in the VM's configuration file is invalid" error in ESXi 5.0 host 

 Click here to view full document
After migrating the datastore of a virtual machine, you experience these issues:
  • Unable to power on the virtual machine.
  • You see the error:

    An unexpected error was received from the ESX host while powering on VM vm-xxxxx.
    Failed to power on VM.
    Unable to create a swap file. The value of 'sched.swap.dir' specified in the VM's configuration file is invalid.


  • Migrating the virtual machine to the original datastore resolves the issue.
This issue occurs when the sched.swap.dir path is not updated in the .vmx file of the virtual machine after migrating it to the new datastore.
To resolve this issue, update the sched.swap.dir to the new datastore manually:
  1. Connect to the ESXi host with an SSH session using root credentials. For more information, see Using ESXi Shell in ESXi 5.x and 6.0 (2004746).
  2. Navigate to the virtual machines directory on the ESX host by running this command:

    cd /vmfs/volumes/datastore/virtual_machine/

  3. Open the .vmx file using a text editor:

    vi virtual_machine.vmx

  4. Find the sched.swap.dir entry and update it the path to match the new virtual machine datastore.

    For example:

    sched.swap.dir = /vmfs/volumes/datastore1/testvm/

  5. Reload the virtual machine on the ESXi host. For more information, see Reloading a vmx file without removing the virtual machine from inventory (1026043).

  6. Power on the virtual machine.