VMware Cloud Community
virtual_dave1
Contributor
Contributor
Jump to solution

ESXi 5.1 Scratch vs VM Swap Locations

Hi

I'm running ESXi5.1U1 from an SD card with no local persistent storage.

I configure persistent scratch location as per KB1033696.  No problem var,log,download,core folders created and all is well.


Now i want to configure VM Swap file location, through the GUI i would go to "Configuration\Software\Virtual Machine Swapfile Location" and point it to a VMFS datastore.  No problem.


My question is - how do i set the VM Swapfile location via command line?


Thanks.


D

Tags (5)
Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

These commands only work for a standalone host and not for hosts attached to vcenter.

esxcli system settings advanced set -o /Mem/HostLocalSwapDir –s “Path to datastore”

esxcli system settings advanced set -o /Mem/HostLocalSwapDirEnabled -i 1

These commands are not applicable for applying to host profiles.

Once you add it to vCenter, the Host local SwapDir Enabled value becomes 0.

View solution in original post

Reply
0 Kudos
5 Replies
admin
Immortal
Immortal
Jump to solution

These commands only work for a standalone host and not for hosts attached to vcenter.

esxcli system settings advanced set -o /Mem/HostLocalSwapDir –s “Path to datastore”

esxcli system settings advanced set -o /Mem/HostLocalSwapDirEnabled -i 1

These commands are not applicable for applying to host profiles.

Once you add it to vCenter, the Host local SwapDir Enabled value becomes 0.

Reply
0 Kudos
virtual_dave1
Contributor
Contributor
Jump to solution

Thanks AakashJ.  That works as you describe.

My goal is (was) to use it in a kix build script but seemingly that will be difficult.

What is the reason for it being reset when the host is added to vCenter?  Just for my understanding.


Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Any usage of esxcli bypasses hostd which in turn leads to unsynchronized state between hostd/VC and vmkernel . Even in a case customers use remote version of esxcli - it will still leave VC and vmkernel in unsynchronized states. These two options should be declared as "hidden" option so that the user does not get tempted to set them

admin
Immortal
Immortal
Jump to solution

Mark my post as "helpful" or "correct" if I've helped resolve or answered your query!

Reply
0 Kudos
virtual_dave1
Contributor
Contributor
Jump to solution

OK thanks.  So at this current moment in time, would it be fair to say it is not possible to set the VM Swapfile Location property (in any useful way) via command line?  (assuinng vsphere 5.1U1 and vcenter is in use).

We configure vswitches etc. via esxcli during build, and when the host is added to vcenter the information is synchronised from the host to VC.  It is a shame this setting can't also be sync'd from host to VC.  Or am I missing something?

Perhaps this can be done by a vCO workflow after the host is added to vcenter.  I will explore.  Thanks for your time.

Reply
0 Kudos