VirtualBox Jail - Backups via Snapshot -> ZFS Replication Task?

Status
Not open for further replies.

Sasayaki

Explorer
Joined
Apr 20, 2014
Messages
86
Hey all,

Quick sanity check here.

My Freenas Mini arrives in a few days (once I pay GST to get it released from customs...) and I read that the latest version has support for VirtualBox in a jail. That sounds great.

To use it, once it's out of beta, I was going to install a PCIe mSata adaptor, add an mSata SSD there, and run my jails on that including VirtualBox. This is all fine (I think).

However, I am paranoid about backups and data security. The SSD would run ZFS of course. I was going to backup the SSD by taking a daily snapshot (with the VMs running), and then replicate it to the main pool (and possibly the secondary pool too) using a ZFS replication task.

Is this a good idea? Is the ZFS snapshot process atomic enough that the guest OSs won't get corrupted by, say, being in the middle of a critical write when a snapshot is taken?

Any tips for this?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Keep in mind that while snapshots work well for ZFS, your VM will be a living system at the moment of the snapshot. In the event you have to restore from the snapshot you may find the VM not work properly. The only "safe" way to ensure the VM is valid is to shutdown the VM, take the snapshot, then start the VM again. Note that there's no "easy" way to do this automatically :/
 

Sasayaki

Explorer
Joined
Apr 20, 2014
Messages
86
Yeah, I'm aware of that. My plan is to just snapshot every 15 minutes, and ZFS send nightly, so in the rare occasion that the virtual machine was in the process of writing something to the disk that wasn't atomic and got messed up by the snapshot, I have many others to choose from. My VMs tend to be single-purpose appliances (such as an FTP server that shares files from the main FreeNAS pool) so the loss of a few days or even weeks changes is not, usually, a huge problem.

I'll just make it a point of policy to turn everything off once a month or so, then make a manual snapshot, manually ZFS send it to the backup drive, and use that as a "safe point" that I can return to if I need to.
 

DaPlumber

Patron
Joined
May 21, 2014
Messages
246
Remember that from the perspective of the Guest OS in the VM recovering from a snapshot is almost indistinguishable from recovering from a crash when you pulled the plug at the time of the snapshot.

One difference from a real hardware crash is that you can SUSPEND the VM and snapshot it rather than shutting it down with impunity. Considering that ZFS snapshots are almost instantaneous you could set up a cron job that issues the VM command to suspend the VM, trigger the snapshot, and resume the VM. That should be pretty quick, and you could trigger the replication at the same time too. I'm a CLI kind of guy so I'm not sure how much /which parts can be setup in the GUI, so GUI-type person feel free to jump in here.
 

Sasayaki

Explorer
Joined
Apr 20, 2014
Messages
86
Yeah, I know. My plan is to snapshot frequently (every 5-10 minutes) and then, if a VM is in the middle of doing something important when the snapshot occurred, simply use another.

My VMs don't change much so this is a viable option to me.
 
Status
Not open for further replies.
Top