Author : mimartin
Topic Name : Using Swap Files
Publication Name : vSphere Resource Management
Product/Version : VMware vSphere/6.7
Question :
I cannot get ESXi 6.7u2 to honor moving virtual machine swap files. No matter what system setting I use, the swap files stay with the virtual machine. If I edit the virtual machine vmx file, ESXi overwrites my changes even after re-registering the VM. Is this a bug?
Do not include the .swp filename because it does not work like that.
The path should be /vmfs/volumes/
datastore_name/directory_for_swap_files
I'll give this a try soon. I apologize for not responding earlier. For some reason I'm not getting email notifications about updates. I'll update once I give this a try.
Nope. It doesn't work. No matter what I put there, it overwrites my setting & keeps the swap file with the virtual machine. Nothing I do seems to make any difference.
Did you ever get this fixed? I have the exact same issue.
I assume you change it on a cluster level?
Like the OP, the host is not part of a cluster so these settings don't exist.
And you don't have vCenter? As the setting is also available on a host level:
plus you can also set it using the Host Client (at least on 7.x, I have not tried 6.7 U2)
just tried it on 6.7 U2 as well, on a host level using the host client. Seems to work okay for me.
That setting only changes the Host swap location, not the VM swap location it seems.
So you tried to edit it on the host, or don't you have vCenter?
I ended up installing a VCenter trial and setting the option on the host in VCenter and it works.
Interesting. I ran into the same issue with regards to having the swapfile created in a different datastore during VM power on. This is with ESXi 7u1. I followed your steps, added the line with new location and re-registered the VM. Did no other changes. The VM powered up with the new datastore as the swap location. Not sure at this point what options need to be enabled in the GUI for this to work.
Host is standalone also. Thanks for the help.
No, I didn't. I'm still living with all my swap out on the SAN.
My VM is not part of any cluster. IT configured this server to exist outside the main VM cluster as it is for lab/development work.
vSphere doesn't want to connect to my server. I can only make changes via the web interface or SSH. No matter what I do, VMWare insists on putting the VM swap files on the SAN with the VM's. I can't get it to move them to a datastore made of local drives.
Good morning, from your image, you have Datastore listed as VMWareSwap. Does this datastore live on block storage within the ESXi host itself or is it mapped from block storage outside, such as a EMC storage device. I got this to work in a test environment, by following the unregister VM, modifying the vmx file as indicated ( made no changes other than adding the line sched.swap.dir= /vmfs/volumes/datastore2/swap-files) which pointed to datastore local to the ESXi host). Made sure the "edit swap configuration" on the host pointed to this Datastore.
As a added note, this particular ESXi host is running on the 60 day evaulation licence (default during install). Not sure if there is a license issue as to what can and cannot be done.
Good luck on your config.
The VMWareSwap datastore is all local storage inside the ESXI server (~6TB).
I will try doing an unregister-change-re-register as soon as I can. Thank you for the info & will update once I've tried.
Hello.
i have the same issue.
here are some of the test i have done.
1. Stopped the VM
2. Unregister the VM
3. navigated to the VM directory
4. edited the vmx file.
5. changed manually the "sched.swap.derivedName = " to the desired location. (tried with and without the name of the file)
6. saved the file
7. validated the file had been modify with the date and time.
8. re-registered the VM
9. started the VM
10. validate the log files of the VM.
[root@host:/vmfs/volumes/6043aa3f-39c5edae-9adc-d485645165c4/DM_WinPro_Station_1] cat vmware.log | grep sched.swap.derivedName
2021-03-17T20:56:00.181Z| vmx| I125: DICT sched.swap.derivedName = "/vmfs/volumes/hostnvme1/DM_WinPro_Station_1/" < ------ that is the configuration....
2021-03-17T20:56:00.302Z| vmx| A100: ConfigDB: Setting sched.swap.derivedName = "/vmfs/volumes/6043aa3f-39c5edae-9adc-d485645165c4/DM_WinPro_Station_1/DM_WinPro_Station_1-3425 <----- that is what it will use.
11. re-edited the VMX files after stoping the VM...
RESULT: sched.swap.derivedName = "/vmfs/volumes/6043aa3f-39c5edae-9adc-d485645165c4/DM_WinPro_Station_1/DM_WinPro_Station_1-3425b2b7.vswp"
the VMX file was re-writen by the host....
after i did my change : -rwxr-xr-x 1 root root 3320 Mar 17 20:55 DM_WinPro_Station_1.vmx
after i restarted the VM : -rwxr-xr-x 1 root root 3379 Mar 17 20:57 DM_WinPro_Station_1.vmx
that mean that the host continuously re-write it.... with the old value.
i have not downloaded the VMX file locally to my station and deleted the old one.
should that be done ? and why ???? if we are root and that we change the VMX file and save it.. that should be enough..
OR...
there are permissions that needs to be set that i dont know of...
anyone has an idea.... this is kind of stupidly critical..
thanks in advance.