Simple backup script for VMWare Workstation.

There are more sophisticated ways of doing this, but here is a simple script I’m using to backup my virtual machines. It runs out of cron at 3am on Sundays. I also take snapshots of the VM before any major change.

[code lang=”bash”]
#!/bin/bash

echo "BACKUP Virtual Machines Initiated"
echo "Suspending running VMs"
vmrun -T ws suspend "/datastore/Virtual Machines/Windows 7 x64/Windows 7 x64.vmx"
echo "Copying VMDKs"
rsync -az "/datastore/Virtual Machines/Windows 7 x64" "/backup/Virtual Machines"
echo "Restarting suspended VMs"
vmrun -T ws start "/datastore/Virtual Machines/Windows 7 x64/Windows 7 x64.vmx"
echo "Complete"

[/code]

This entry was posted in Code.

Post a Comment

You must be logged in to post a comment.