Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 May 2016 14:02:27 +0300
From:      Lev Serebryakov <lev@FreeBSD.org>
To:        fs@freebsd.org
Subject:   ZFS hierathy, snapshots and backup tool -- how to traverse snapshotted tree properly?
Message-ID:  <886527019.20160508140221@serebryakov.spb.ru>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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.

-- 
Best regards,
 Lev                          mailto:lev@FreeBSD.org
[-- Attachment #2 --]
-----BEGIN PGP MESSAGE-----
Version: GnuPG v2.0.22 (MingW32)

iQJ8BAEBCgBmBQJXLxzDXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGOTZEMUNBMEI1RjQzMThCNjc0QjMzMEFF
QUIwM0M1OEJGREM0NzhGAAoJEOqwPFi/3EePr0oP/A1oOzA+bJ/hzpgNimvYEiS8
X/aEzthaekt1/Bzism+sVBmRPSima8D2o7iwUQ5mBkycokXJOREfgPbDyBvjsKBi
mspA7G2B6oU6Ui53xXzNoVS77VD+WJd1m6PzGSvKxjNwWwWXDvBKVsLgk9aqtIWu
7Fzm98koz6xiY2rbzpFxFfqtlACV8TckvV2O1g8Dyb35W20+ANmoKg2AvC7LIJbW
zdVi0Ev9VqSqFalu+lgn5AaV3U3axWhb5q4tPZibrrMylSQijrjo/HDr4ne+VB4z
wTr0BmTPyNUbYUjJKgexGzXIdJlM9uA6uhGjZOhQT2NEH7sCG8b1wfE4QkmCTvfi
rJee6nhNNVwljrzXu95NIxRpa2jZVdza+No6b94C9m9Etpku4YIMQwml3en+3R8R
WfRHdI0RGBDKna5Y6pSu4FL40tN9I5NqO9l+EtUsvPB+15bDJUFC7xwtbCiiz7Qk
lw59xPlH+4e3CPeZq/BO2jKeSamygvf4f5FkyvQMZTmJX0SdHG5tiQVROFspuCCu
grjSoaAchq/Hd+ZzW+nQMMePMvn0VCXYfkh24dKgu6xI3BTuSCn+i98rkiZHM37S
soIEW2Lbe3+tJd/Q0tHOgV/Maoa5r9f6KmlaL9vHLtVybxQ1pckLtKCwra19jaBM
jYPfzSAj2tpUyxBbOp3h
=eKje
-----END PGP MESSAGE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?886527019.20160508140221>