ZFS hierathy, snapshots and backup tool -- how to traverse snapshotted tree properly?

Ronald Klop ronald-lists at klop.ws
Sun May 8 18:33:45 UTC 2016


On Sun, 08 May 2016 13:02:27 +0200, Lev Serebryakov <lev at freebsd.org>  
wrote:

> Hello Fs,
>
>   I'm writing some backup tool (yet another, don't ask!) and encounter  
> some
>  "inconvenience" in ZFS snapshot system, for which I don't see good  
> solution
>  (all I could imagine is kludgy and ugly). Maybe, there is some approach  
> I
>  didn't notice or some ZFS-specific API I should now?
>
>   Lets say, here is some hierarchy of ZFS file systems. For example, I  
> will
>   use "/home" which have one filesystem per user:
>
>     zpool/home/user1 -> /home/user1
>     zpool/home/user2 -> /home/user2
>     zpool/home/user3 -> /home/user3
>
>  But it could be much more complex hierarchy.
>
>  Now, we have backup tool, which works with filesystem tree. If I want to
> backup all my users, I could setup it to backup "/home" and everything
> works even if users will be added (or removed) in future.
>
>   But STOP! We want to backup snapshot, if our filesystem supports
> snapshots! It is good idea! ZFS supports snapshot!
>
>   It is easy to teach backup tool to call
>
> zfs snapshot -r ${backup_root}@${randomname}
>
>   at beginning and
>
> zfs destroy -r ${backup_root}@${randomname}
>
>   at the end of the process. No problems here.
>
>    Problems are, how backup tool should TRAVERSE snapshotted directory  
> tree
>  now?
>
>    Simple "go to ${backup_root}/.zfs/${randomname}" DOESN'T WORK! Because
>  /home/.zfs/${randomname} does not contain user directories. They are
>  separate FSes and have separate paths for their snapshots. Traversing
>  "live" tree but getting data from snapshots is not proper way to do  
> this,
>  for sure, as it is depreciate whole idea of snapshots.
>
>   Is here good solution for this problem?
>
>   Of course, it is possible to configure each FS for backup tool  
> one-by-one,
>  but I don't like this  solution, as in ZFS world there could be very  
> deep
>  and nested FS  hierarchies. Also, configuring each FS separately in  
> backup
>  tool configuration leads to forgotten FSes in long-term maintenance for
>  sure.
>

I have used a monitoring tool like Nagios to periodically check if all  
filesystems are configured in the backup tool and vice versa.

Ronald.


More information about the freebsd-fs mailing list