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

Daniel Kalchev daniel at digsys.bg
Thu Jul 4 11:00:19 UTC 2013


On 04.07.13 12:48, Berend de Boer wrote:
>>>>>> "Berend" == Berend de Boer <berend at pobox.com> writes:
>      Berend> Do you think (yes, I will definitely test this), that ZFS
>      Berend> can mount a file system consisting of a couple of disk
>      Berend> (raidz2 setup), and access it even though every disk might
>      Berend> be a backup taken at a slighty different time?
>
> Answering my own question: raidz2, four disks, 128GB disks each, no
> writing happening can be backed up with an EBS snapshot, then turned
> into volumes (disks) again and mounted on another FreeBSD without
> apparent ill effects.
>
> The snapshots of the four disks were about 2 seconds apart each.
>
> zfs took perhaps 30 seconds to start on the second server.

It apparently had to replay the ZIL.

> No snapshot was available (only had done one of a file system, no zfs
> snapshot -r was ever done). Didn't do any rollback.

As mentioned earlier, doing this is merely emulating (graceful) power 
loss of the system, or a sudden reboot if you will -- without unmounting 
the file systems.
ZFS guarantees that your file system will be always consistent, at the 
cost of losing some data  -- minimized by the ZIL if your applications 
used synchronous writes.

> Next step is to do take the snapshot while writing stuff is going on.

The snapshot will 'record' the known file system state. This does not 
necessarily mean it will record what you think it should, because 
applications might hold data in memory that makes their stored state 
consistent. ZFS has no way to know any of this (nor does any other 
filesystem).
Exactly what happens when your system suddenly reboots. ZFS will 
guarantee the file system consistency.

> Then what you suggested: taking a snapshot first, and rollback after mount.

Taking a snapshot at some point of time will guarantee you have the file 
system state at that time.
There will be difference with not taking a snapshot, only if your 
applications do not use synchronous writes where they should, because 
the snapshot will make the pending writes synchronous (I believe this is 
the case, or it would not be consistent).

if your applications always do sync writes, for example an NFS server, 
whether you do the snapshot or not will not make any difference.

But you should test it anyway. :)

Daniel


More information about the freebsd-fs mailing list