Comment VMware Snapshot alternate Datastore - 11/20/08
Frustrated by the amount of disk consumed by multiple machines with Snapshots on the same LUN? Got a server with a VDMK that consumes all but a tiny fraction of the datastore it is located?
Here’s a potential solution leveraging a little documented VMX statement. Please be aware that, while uses this method works from a functional point of view; I would tread carefully as it’s behavior could change unexpectedly in future versions of ESX and/or Virtual Center.
Because this statement by default places the virtual machine swap file in the same alternate datastore as the snapshot, I recommend only executing this if you are running ESX 3.5, which allows you to control the swap file placement.
I won’t hold your hand while executing this, but here is a outline of all the steps required, besure to use the datastores GUID and not the label.
Steps
- Shutdown the Virtual Machine cleanly.
- Log onto the Service console of the host the VM is registered as root, or an id with access to root level permissions.
- Edit the vmx – sudo vi /vmfs/volumes/DatastoreofVM/VMname/VMname.vmx
- Remove the following lines from the vmx
- sched.swap.derivedName
- workingDir (if present)
- Save the file
- [Esc] [colon] w
- Re-add the following lines as follows
- workingDir = “/vmfs/volumes/SNAPSHOT-DATASTORE-GUID/VMname/”
- Don’t forget the trailing /
- Save the file and exit
- [Esc] [colon] wq
- Create the snapshot directory and set the correct permissions
- sudo mkdir /vmfs/volumes/SNAPSHOT-DATASTORE-LABEL/VMname
- sudo chown root.root /vmfs/volumes/SNAPSHOT-DATASTORE-LABEL/VMname
- sudo chmod 775 /vmfs/volumes/SNAPSHOT-DATASTORE-LABEL/VMName
Checkout
In Virtual Center, locate the VM, right click on it and Edit Settings…, in the options tab you should observe that the Working directory parameter is set to [SNAPSHOT-DATASTORE-LABEL]/VMName.
I have executed these steps, sometimes having to unregister the machine prior to beginning, and re-registering it after completing the changes, and others just making them and powering the VM on.
If you choose to do this; in addition to support concerns, don’t forget to think about redundancy of access to the datastore, the performance of the datastore, etc.
Personally, the best use of this would be to place Snapshots on a high performance NFS mount that can be monitored for space consumption and expanded at will.
Leave a Comment
Allowed XHTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>