Scheduling VMWare Fusion Snapshots

One really great feature of virtual machines (VMs) is the ability to take a snapshot. These serve as a restorable point in time state of the machine. They are great to run when testing out a new app on a basic patched build of an OS. When you want to remove what you did, simply restore to the pre-state snapshot.

An issue I’ve had with VMWare Fusion is the inability to schedule when a snapshot occurs, other than hourly, weekly, daily, etc. If set to daily, approximately 24 hours after the VM has been running it will suspend, take the snapshot, then resume. A downside to this approach is sometimes it can be 9:15AM, in the middle of your production day. So the question becomes, how do you schedule it better?

By using the VMWare command line tools, you have some pretty great control over the GUI app. One such command:

vmrun snapshot /path/to/your/vm snapshot_name`date +"%Y%m%d"`

allows a command-line way to create a snapshot of the vmware file located at the above path, named snapshot_name with the year, month, and day added to the file name.  By turning off the schedule of snapshots in VMWare Fusion and creating a lunchd task running, at say 2AM, you can have greater control over the time in which your snapshot runs.  Along the same lines, you can run this via launchd at other intervals than VMWare’s built-in tool can run.

For this to work, you will need to add /”Library/Application\ Support/VMware\ Fusion” to your PATH.

Enjoy!

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

No comments yet... Be the first to leave a reply!

Leave a Reply