Loading

×Sorry to interrupt
CSS Error

Refresh

Cookie Preference Center

General Information on cookies

When you visit our website, we use cookies to ensure that we give you the best experience. This information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience on the site and the services we are able to offer. Further information can be found in our

Cookie Policy.

Strictly Necessary

Strictly Necessary

Always Active

Strictly Necessary

Strictly necessary cookies are always enabled since they are essential for our website to function. They enable core functionality such as security, network management, and website accessibility. You can set your browser to block or alert you about these cookies, but this may affect how the website functions. For more information please visit www.aboutcookies.org or www.allaboutcookies.org.

Cookie Details‎

Performance

Performance

Performance

Performance cookies are used to analyze the user experience to improve our website by collecting and reporting information on how you use it. They allow us to know which pages are the most and least popular, see how visitors move around the site, optimize our website and make it easier to navigate.

Cookie Details‎

Please confirm your settings by refreshing the page.

Functional

Functional

Functional

Functional cookies help us keep track of your past browsing choices so we can improve usability and customize your experience. These cookies enable the website to remember your preferred settings, language preferences, location and other customizable elements such as font or text size. If you do not allow these cookies, then some or all of these services may not function properly.

Cookie Details‎

Advertising

Advertising

Advertising

Advertising cookies are used to send you relevant advertising and promotional information. They may be set through our site by third parties to build a profile of your interests and show you relevant advertisements on other sites. These cookies do not directly store personal information, but their function is based on uniquely identifying your browser and internet device.

Cookie Details‎

Advertising Cookies

Consent Leg.Interest

Select All Vendors

Select All Vendors

Select All Hosts

Select All

Clear Filters

Information storage and access

Apply

Confirm My Choices Reject All Allow All

Skip to main content

My Subscriptions

Loading

Knowledge Base

Storing a virtual machine swap file in a location other than the default in ESX/ESXi (1004082)

Last Updated: 3/20/2024Categories: How toTotal Views: 22659Language:
Chinese (Simplified)Portuguese (European)JapaneseSpanishEnglish

6 like this article

Subscribe to get an email
newsletter with new updates

6 people found this helpful Please provide article feedback:

Purpose

This articles provides steps to change the default location of your virtual machines swap files.

Resolution

Moving the swap file to an alternate datastore is a useful troubleshooting step if the virtual machine or guest operating system is experiencing failures, including STOP errors, read-only file systems, and severe performance degradation issues during periods of high I/O. However, identifying and resolving the underlying overcommit or storage performance issues is still recommended to ensure environment stability.

This can also be used to store the virtual machine swap files in an alternate non-replicated datastore when using LUN snapshot technologies to ensure that you are storing the swap files in a location that is not being replicated.

ESXi/ESX 3.5, 4.x, and ESXi 5.x

Note: For ESXi 6.0 please see: https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.vm_admin.doc/GUID-D888BE08-187B-4FF2-9918-7EC27D0EC376.html
Note: For ESXi 6.5 please see: https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.vm_admin.doc/GUID-D888BE08-187B-4FF2-9918-7EC27D0EC376.html
Note: For ESXi 6.7 please see: https://docs.vmware.com/en/VMware-vSphere/6.7/com.vmware.vsphere.vm_admin.doc/GUID-D888BE08-187B-4FF2-9918-7EC27D0EC376.html

Note: If your hosts are part of an HA Cluster, you must change the cluster settings for virtual machine swap file location prior to executing the steps below. For more information, see the Change the Swap File Location section in the Virtual Machine Admin Guide for your version.

To edit the virtual machine swap file location in ESXi/ESX 3.5, 4.x, and ESXi 5.x:

Connect directly to your host or to your vCenter Server using the VMware Infrastructure/vSphere Client.

Click the Configuration tab for the ESXi/ESX host.

Click Virtual Machine Swapfile Location and click Edit.

Specify the datastore where you want to store the virtual machine swap files.

To complete the action the virtual machine will need to be powered off, then powered on.

Ensure the swap file is located on the specified host datastore.

To change the swap file location for a single virtual machine:

Power off the virtual machine.

Unregister the virtual machine. Right-click the virtual machine in the Inventory and choose Remove from Inventory.

Connect to the host:

For ESX, use an SSH client. For more information, see Connecting to an ESX host using a SSH client (1019852).

For ESXi, use Tech Support Mode. For more information, see Tech Support Mode for Emergency Support (1003677) or Using Tech Support Mode in ESXi 4.1 and ESXi 5.x (1017910).

Change directory to the folder where the virtual machine resides:

cd /vmfs/volumes/datastore_name/virtual_machine_folder/

Edit the virtual machine's configuration file with a text editor.

Add this line:

sched.swap.dir = /vmfs/volumes/datastore_name/dir_name

Register the virtual machine again. For more information, see Registering or adding a virtual machine to the inventory on vCenter Server or on an ESXi/ESX host (1006160).

ESX 3.0

Add this line to your virtual machine's configuration (.vmx) file to store the swap on a VMFS-3 volume:

sched.swap.dir= "/vmfs/volumes/volume_name/dir_name"

Where volume_name is the name of a VMFS-3 volume.

To change the swap file location:

Connect to vCenter Server or directly to your ESX host using the vSphere Client.

Select either a virtual machine or a virtual machine template that you want to modify.

Stop the virtual machine, if it is running.

Connect to the ESX console using SSH or a service console connection.

Change directory to the path of the .vmx file you want to edit.

Note: Use the vmware-cmd -l command to find the path to the configuration file. For more information on the vmware-cmd command, see the VMware Scripting API.

Open the configuration file in a text editor and add this line:

sched.swap.dir= "/vmfs/volumes/volume_name/dir_name"

Delete this line:

sched.swap.derivedName = xxx

To complete the action the virtual machine will need to be powered off, then powered on.

Ensure the swap file is located on the specified host datastore.

Repeat for each existing virtual machine, as required.

Related Information

Virtual machine swap file location affects vMotion compatibility in different ways, depending on the version of ESXi running on the virtual machine's host. You can configure ESX/ESXi 3.5 or later hosts to store virtual machine swap files along with the virtual machine configuration file or on a local swap file datastore specified for that host. The impact of the location of the virtual machine swap file on vMotion compatibility includes these:

For migrations between hosts running ESX/ESXi version 3.5 and later, vMotion and migrations of suspended and powered-off virtual machines are allowed.

During a migration with vMotion, if the swap file location specified on the destination host differs from the swap file location specified on the source host, the swap file is copied to the new location. This may result in slower migrations with vMotion. If the destination host cannot access the specified swap file location, it stores the swap file with the virtual machine configuration file.

For additional information about editing the configuration file of a virtual machine, see Tips for editing a .vmx file (1714).

For translated versions of this article, see:

Português: Como armazenar arquivo de permuta de uma máquina virtual em local diferente do padrão (2037188)

Tech Support Mode for Emergency Support
How to register/add a VM to the Inventory in vCenter Server
Using Tech Support Mode in ESXi 4.1, ESXi 5.x, and ESXi 6.x
Connecting to an ESX host using an SSH client
Tips for editing a .vmx file
Migrating virtual machine swap (.vswp) files from one datastore to another
Como armazenar arquivo de permuta de uma máquina virtual em local diferente do padrão
Almacenamiento del archivo swap de una máquina virtual en una ubicación distinta a la predeterminada
ESX/ESXi のデフォルト以外の場所に仮想マシン スワップ ファイルを保存する
将虚拟机交换文件存储在除默认位置以外的位置

Detectable by VMware SkylineTM

Actions

Copy

link to clipboard
copied!

Print

Language:
Chinese (Simplified)Portuguese (European)JapaneseSpanishEnglish

Attachments

Additional Resources

KB
•
Increasing the disk space for the vCenter Server Appliance in vSphere 6.5, 6.7, 7.0 and 8.0 (2145603)

Result 1 of 1

Ask The Community

Get answers quickly from VMware experts in the community

Post Subject

CONTINUE IN COMMUNITIES

Related Products:

VMware vSphere ESXi

VMware ESX Server

Related Versions:

VMware vSphere ESXi 6.7

VMware vSphere ESXi 6.5

VMware vSphere ESXi 6.0

VMware vSphere ESXi 5.1

VMware vSphere ESXi 5.0

VMware ESXi 4.1.x Installable

VMware ESXi 4.1.x Embedded

VMware ESXi 4.0.x Installable

VMware ESXi 4.0.x Embedded

VMware ESX Server 3.5.x

VMware ESX Server 3.0.x

VMware ESX 4.1.x

VMware ESX 4.0.x

view all

Take Our Survey

Was this article helpful?

YES

NO

Copyright © 2005-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.

Terms of Use

Your California Privacy Rights

Privacy

Accessibility

Cookie Settings

Support Assistant