VMware Cloud Community
PcPixel
Enthusiast
Enthusiast

ESXI 6.7U2 ignores virtual machine swap location

Author : mimartin

URL : http:////docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.vsphere.resmgmt.doc/GUID-B55F4F6B-44E6-46D...

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?

41 Replies
Lalegre
Virtuoso
Virtuoso

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

0 Kudos
PcPixel
Enthusiast
Enthusiast

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.

0 Kudos
PcPixel
Enthusiast
Enthusiast

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.

0 Kudos
billz0r
Contributor
Contributor

Did you ever get this fixed? I have the exact same issue.

0 Kudos
depping
Leadership
Leadership

I assume you change it on a cluster level?

Screenshot 2021-01-18 at 12.23.35.png

0 Kudos
billz0r
Contributor
Contributor

Like the OP, the host is not part of a cluster so these settings don't exist.

0 Kudos
depping
Leadership
Leadership

And you don't have vCenter? As the setting is also available on a host level:

Screenshot 2021-01-18 at 14.02.12.png

0 Kudos
depping
Leadership
Leadership

plus you can also set it using the Host Client (at least on 7.x, I have not tried 6.7 U2)

Screenshot 2021-01-18 at 14.05.10.png

0 Kudos
depping
Leadership
Leadership

just tried it on 6.7 U2 as well, on a host level using the host client. Seems to work okay for me.

0 Kudos
billz0r
Contributor
Contributor

That setting only changes the Host swap location, not the VM swap location it seems.

depping
Leadership
Leadership

So you tried to edit it on the host, or don't you have vCenter?

0 Kudos
billz0r
Contributor
Contributor

I ended up installing a VCenter trial and setting the option on the host in VCenter and it works.

0 Kudos
Far2Near
Contributor
Contributor

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.

0 Kudos
PcPixel
Enthusiast
Enthusiast

No, I didn't. I'm still living with all my swap out on the SAN.

0 Kudos
PcPixel
Enthusiast
Enthusiast

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.

0 Kudos
PcPixel
Enthusiast
Enthusiast

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.

0 Kudos
PcPixel
Enthusiast
Enthusiast

I have my server set up to use a specific datastore for swap. I've got the VM configure to use the location defined by the host for swap as its swap location. It still ends up in the location of the VM.

 

Nothing I try seems to fix it at allo.

0 Kudos
Far2Near
Contributor
Contributor

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. 

0 Kudos
PcPixel
Enthusiast
Enthusiast

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.

0 Kudos
Steeve_Savard
Contributor
Contributor

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.

0 Kudos