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

Hey PcPixel​,

Have you first configured the Swap File location at Cluster level?

0 Kudos
PcPixel
Enthusiast
Enthusiast

VMWareTemp.png

Yes, I believe I did. This is a stand alone ESXi install, not part of a cluster. If I look at the that data store, I can see a vswp file for the host in the root of the data store.VMwareSwapFile.png

0 Kudos
Lalegre
Virtuoso
Virtuoso

That configuration you are following are for the ESXi System Swap file NOT for the VM Swap File. For configuring it you should follow the next procedure: Configure Virtual Machine Swapfile Properties for the Host

0 Kudos
PcPixel
Enthusiast
Enthusiast

Correct. that is for the VM host. However, if I do follow those instructions you posted, ESXi completely ignores them. No matter how I configure those options, the swap files for the VM's stay with the VM's. If I manually edit the VMX file to specifically place the swap file where I want it, ESXi just overwrites the setting. I deregister and regestister the VM before making that change.

0 Kudos
PcPixel
Enthusiast
Enthusiast

VM-swapoptions.png

If I use the first option, the swap file stays with the VM. If I use the second one, it stays with the VM (which makes sense at least). If I use the third option, it still stays with the VM.

vm-specificlocation.png

Regardless of which of the 3 above I pick, no matter what I set this parameter to, ESXi tosses it out & overwrites it.

0 Kudos
Lalegre
Virtuoso
Virtuoso

Could be possible that you have another configuration here: Enable Host-Local Swap for a Standalone Host ?

0 Kudos
PcPixel
Enthusiast
Enthusiast

I'm not sure. I can only use the web vSphere client so the instructions don't totally match up. I'll see

0 Kudos
Lalegre
Virtuoso
Virtuoso

It should match because is the same client adn version as that procedure is for Standalone host.

0 Kudos
PcPixel
Enthusiast
Enthusiast

The only place I can find that option is inside the vmx file: sched.swap.hostLocal = "disabled" . 

These two lines are present in my current vmx:

sched.swap.hostLocal = "disabled"

sched.swap.derivedName = "/vmfs/volumes/5ee29462-20daed4c-b5f8-48df37d688a4/vmswp/DUMMY/DUMMY - Firewall-4ba521df.vswp"

If I power on the VM, it tosses those out & keeps the swap files with the VM. I don't get what I'm doing wrong.

0 Kudos
PcPixel
Enthusiast
Enthusiast

1. Browse to host:

1-browsetohost.png

This ESXi install it not part of a cluster at all. It's completely stand alone. I can only access it via the web client or by directly editing vmx files.

0 Kudos
Lalegre
Virtuoso
Virtuoso

Mmm that is strange, what if you do the next:

1. Unregister the VM.

2. Download the .vmx and add the following line:

3. Create a directory for Swap files under the datastore.

4. Add the next line into the .vmx: sched.swap.dir = /vmfs/volumes/datastore_name/dir_name

5. Upload the VMX, register and Power-On the VM.

However this is to confirm that it works is not a definitive solution as this is per VM config.

PcPixel
Enthusiast
Enthusiast

What should I add in your step 2?

0 Kudos
Lalegre
Virtuoso
Virtuoso

Haha my bad, follow this:

1. Unregister the VM.

2. Download the .vmx.

3. Create a directory for Swap files under the datastore you want.

4. Add the next line into the .vmx downloaded in Step 2: sched.swap.dir = /vmfs/volumes/datastore_name/dir_name

5. Upload the VMX, register and Power-On the VM.

PcPixel
Enthusiast
Enthusiast

VM set to "keep swap file with VM". Downloaded the VMX. Changed sched.swap.derivedName to sched.swap.dir="/vmfs/volumes/5ee29462-20daed4c-b5f8-48df37d688a4/vmswp/DUMMY/DUMMY - Firewall-4ba521df.vswp". Uploaded file & verified line exists. Verified folder structure exists are well. I get "Failed to power on vbirtual machine - Module "MonitorLoop" power on failed."

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

This is the data store I'm trying to use:

VMware-storageUUID.png

This the current data store layout:

VMware-tempdatastore.png

0 Kudos
Lalegre
Virtuoso
Virtuoso

This happens if the path you are specifying is wrong.

Try to create a directory under the root directory called swap-files and change to this:

sched.swap.dir= /vmfs/volumes/5ee29462-20daed4c-b5f8-48df37d688a4/swap-files

PcPixel
Enthusiast
Enthusiast

Set to: sched.swap.dir="/vmfs/volumes/5ee29462-20daed4c-b5f8-48df37d688a4/swap-files/DUMMY - Firewall-4ba521df.vswp". I got the same error.

VMWareswap-new.png

using sched.swap.derivedName doesn't work either. Puts the swap file in the VM host directory.

0 Kudos
PcPixel
Enthusiast
Enthusiast

I also tried stopping the path at "swap-file" and it still failed as well.

0 Kudos
Lalegre
Virtuoso
Virtuoso

Hey,

But wait, are you specifying the .swp file inside the path? If yes, do not do that, just the datastore and the folder name. Also please try to specify the Datastore name instead of the ID.

PcPixel
Enthusiast
Enthusiast

Yes, I'd been including the .swp filename as well. I was trying to keep the file consistent. I can try again with just the path. So for the datastore name, it should be [DATASTORE_NAME]/[PATH] versus /vmfs/volumes/[VOLUMEID]/[PATH], correct?

0 Kudos