Friday, January 14, 2011

Creating snapshots in a different location than default virtual machine directory

All snapshots are created in a default virtual machine directory. Even if the .vmdk disk file is located on different datastore than the virtual machine itself, delta files are created in the default virtual machine directory.

You may want to change the location where delta files are created, if you want to:

*
Create snapshots but do not have enough space on the VMFS volume.
*
Power on a virtual machine when there is not enough space to create a swap file on the VMFS volume.

This article describes how to change the default virtual machine directory location for snapshots.
Solution
To change the default virtual machine directory location for snapshots:

1.
Power off the virtual machine.
2.
Add the following line to the .vmx configuration file for the virtual machine:

workingDir=""

For example:

workingDir="/vmfs/volumes/46f1225f-552b0069-e03b-00145e808070/vm-snapshots"

Note: Alternatively, if your datastore has been called Datastore1, you can specify workingDir="/vmfs/volumes/Datastore1/vm-snapshots" instead of the UUID as demonstrated above.

3.
Reload the virtual machine by unregistering and re-registering it. For more information, see Registering or adding a virtual machine to the inventory (1006160).
4.
If you do not want to redirect the virtual machine's swap file, add this line to the .vmx configuration file and reload the configuration file:

sched.swap.dir=""

This ensures that the swap file is created in the same directory as the virtual machine.

5.
Power on the virtual machine.

Note: If you are performing a storage vMotion or storage migration of a virtual machine that has the working folder set to a location other than the virtual machine directory, this change is lost and you must re-configure to reset i

No comments:

Post a Comment