VMware Cloud Community
RDuncan
Contributor
Contributor
Jump to solution

Swapfile

Having relocated the virtual swapfile to another vmdk on diffferent storage I cannot seem to get rid of the original swapfile on the C: drive

0 Kudos
1 Solution

Accepted Solutions
Cameron2007
Hot Shot
Hot Shot
Jump to solution


To change the swap file location for a single virtual machine:
1. Power off the virtual machine.
2. Unregister the virtual machine. Right-click the virtual machine in the Inventory and choose Remove from Inventory.
3. Connect to the host:
4. Change directory to the folder where the virtual machine resides:

cd /vmfs/volumes/datastore_name/virtual_machine_folder/
5. Edit the virtual machines configuration file with a text editor.
6. Add this line:

sched.swap.dir = /vmfs/volumes/datastore/
7. Register the virtual machine again.


check the datastote and the *.vswp file will now have moved

View solution in original post

0 Kudos
9 Replies
Cameron2007
Hot Shot
Hot Shot
Jump to solution

to change swap file location per host

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

  1. Connect directly to your host or to your vCenter Server using the VMware Infrastructure/vSphere Client.
  2. Click the Configuration tab for the ESX host.
  3. Click Virtual Machine Swapfile Location and click Edit.
  4. Specify the datastore where you want to store the virtual machine swap files.
  5. After restarting your virtual machines, ensure the swap file is located on the specified host datastore.
RDuncan
Contributor
Contributor
Jump to solution

This looks good, but I want to be able to do this to individual VMs

0 Kudos
Cameron2007
Hot Shot
Hot Shot
Jump to solution


To change the swap file location for a single virtual machine:
1. Power off the virtual machine.
2. Unregister the virtual machine. Right-click the virtual machine in the Inventory and choose Remove from Inventory.
3. Connect to the host:
4. Change directory to the folder where the virtual machine resides:

cd /vmfs/volumes/datastore_name/virtual_machine_folder/
5. Edit the virtual machines configuration file with a text editor.
6. Add this line:

sched.swap.dir = /vmfs/volumes/datastore/
7. Register the virtual machine again.


check the datastote and the *.vswp file will now have moved

0 Kudos
RDuncan
Contributor
Contributor
Jump to solution

Excellent, this has been most irritating, thank you.

0 Kudos
rickardnobel
Champion
Champion
Jump to solution

RDuncan wrote:

I cannot seem to get rid of the original swapfile on the C: drive

And you are not referring to the internal swapfile on the the C: drive?

My VMware blog: www.rickardnobel.se
0 Kudos
Cameron2007
Hot Shot
Hot Shot
Jump to solution

you can also clear the pagefile ny using the method here :

http://support.microsoft.com/kb/314834

0 Kudos
rickardnobel
Champion
Champion
Jump to solution

Cameron2007 wrote:

you can also clear the pagefile ny using the method here :

http://support.microsoft.com/kb/314834

This registry change will zero out the internal page file of the Windows guest. When shutting down or rebooting e.g. a 4 GB VM there will be 4 GB of write IOs and is only for security issues if the harddisk should get stolen while the system is shut down.

It might lead to worse overall IO performance of the SAN and very slow reboot of Windows servers.

My VMware blog: www.rickardnobel.se
0 Kudos
Cameron2007
Hot Shot
Hot Shot
Jump to solution

otherwise Computer icon's Properties>Advanced System Settings>Advanced>Settings>Change ...etc

0 Kudos
rickardnobel
Champion
Champion
Jump to solution

Cameron2007 wrote:

otherwise Computer icon's Properties>Advanced System Settings>Advanced>Settings>Change ...etc

This is the way to change the pagefile size, the registry change above is something very different and only leads to slow reboot times.

My VMware blog: www.rickardnobel.se
0 Kudos