EBS snapshot backups from a FreeBSD zfs file system: zpool freeze?

Will Andrews will at firepipe.net
Wed Jul 3 06:53:21 UTC 2013


On Wednesday, July 3, 2013, Kevin Day wrote:

> The closest thing we can do in FreeBSD is to unmount the filesystem, take
> the snapshot, and remount. This has the side effect of closing all open
> files, so it's not really an alternative.
>
> The other option is to not freeze the filesystem before taking the
> snapshot, but again you risk leaving things in an inconsistent state,
> and/or the last few writes you think you made didn't actually get committed
> to disk yet. For automated systems that create then clone filesystems for
> new VMs, this can be a big problem. At best, you're going to get a warning
> that the filesystem wasn't cleanly unmounted.
>

Actually, sync(2)/sync(8) will do the job on ZFS. It won't stop/pause I/O
running in other contexts, but it does guarantee that any commands you ran
and completed prior to calling sync will make it to disk in ZFS.

This is because sync in ZFS is implemented as a ZIL commit, so transactions
that haven't yet made it to disk via the normal syncing context will at
least be committed via their ZIL blocks. Which can then be replayed when
the pool is imported later, in this case from the EBS snapshots.

And since the entire tree from the überblock down in ZFS is COW, you can't
get an inconsistent pool simply by doing a virtual disk snapshot,
regardless of how that is implemented.

--Will.


More information about the freebsd-fs mailing list