To resolve this issue, update the sched.swap.dir to the new datastore manually.
Symptoms:
After migrating the datastore of a virtual machine, you experience these issues:
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.
This issue occurs when the path set in the option sched.swap.dir
is not updated in the .vmx
configuration file of the virtual machine after migrating it to the new datastore.
sched.swap.dir
to reflect the new datastore:# cd /vmfs/volumes/<datastore>/<virtual_machine>/
# cp <virtual_machine>.vmx <virtual_machine>.vmx_bak
.vmx
file using a text editor:
# vi <virtual_machine>.vmx
sched.swap.dir
entry and update it the path to match the new virtual machine datastore.sched.swap.dir = /vmfs/volumes/datastore1/testvm/