Backing up VMware Virtual Machines on FreeNAS

Let me preface this post with 2 things:

  1. It’s going to be short and sweet
  2. It assumes you’re using NFS for your datastores (which you should be – since writes are SYNC, the snapshot should be clean)

First, you need somewhere to move the backing files – in my case, I take a tiered storage approach. VMs run on several spindles of 10K SAS; CIFS storage is on a few 2TB SATA drives; offsite is up to www.crashplan.com.

That being said, all I am really doing is making a copy from VM storage to SATA storage, and CrashPlan is taking care of the offsite. So here’s what you do:

Take a snapshot of your dataset:

zfs snapshot dataset@snapshotName

Next, copy (cp, scp, ftp….) the data from the snapshot to another location:

cp -R /mnt/Dataset/.zfs/snapshot/snapshotName/VMName /mnt/OtherDataset/Backup/.../

Remove the snapshot when you’re done:

zfs destroy dataset@snapshot

That’s it. Save this to your favorite script\job, put it on a schedule and sleep better at night. Why does this work? Because you’re taking storage snapshots of the VM backing files (and zfs snapshots are awesome). Should you also be taking a VMware snapshot of the VM? Probably. But this should work just fine for the lab environment.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.