ZFS Snaphots of my Virtualmin server while it is running - Is this a good thing?

Background

  • I am running my Virtualmin server in a KVM (Virtual Machine).
  • TruneNAS uses ZFS
  • ZFS has the ability to do snapshots.
  • When making a snapshot of your virtual machine you should make sure your virtual machine is shutdown so the data within it is safe and consistent.
  • I am aware Virtualmin and Webmin do backups and these can be used from within the virtual machine.

The question

It is not always possible to shutdown a live Virtual machine to do a snapshot (i.e. web server).

What are your thoughts on doing snapshots on running VMs (i.e. crash consistent backups)?

I have had to do this and it has worked - the backup and the restore.

Ideally we should shut down the database before initiating the snapshot, or at least flush tbl_list with read lock.

But I have been lucky so far with unceremonous snapshots.

Database is generally the primary thing you’d want to worry about when doing a snapshot backup of a web hosting system. It’d probably be fine, in the sense that modern databases are quite resilient to things like power outages and such, so it’d probably come back up without problem, but you might lose data (whatever transactions were in progress at the time of the snapshot). Mail could also be an issue. But, if you’re needing to restore a backup, you’re probably expecting to lose some data from the time when the backup was made to when you’re restoring.

I’m all for having multiple forms of backup. Virtualmin backups are safe…they do a dump of the databases, so they’re in a consistent state that’s controlled by the database server itself. But, a snapshot of the whole VM is useful for recovering the whole system exactly as it was (Virtualmin backups do not backup the whole system).

So, go nuts. Keep multiple kinds of backups. It can’t hurt. You’ll be better off than the poor folks who show up here every week asking for help with data lose and not having backups.

2 Likes

@calport thanks for the feedback

@joe thanks, you have confirmed my feelings. snapshots have their place for emergencies and I should use Virtualmin/Webmin backup system for regular backups to be assured they are safe.

2 solutions…

Put the databases in a zfs dataset alone with the write parameter set to write immediately. There’s a setting in zfs datasets just for databases. Or for anything else that needs to be written immediately.

Or before you do the snapshot, change the current dataset to write immediately, do the snapshot, then change it back.

There’s a huge performance penalty for it, which is why it’s not the default.

Although I’ve done it your way for years and never had an issue.

1 Like

My virtualmin installation is not on ZFS, the virtual machine that it sits on is on ZFS so unfortunately these solutions will not work.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.