|
I would like to take a backup from a zfs snapshot directory. The backup path is changing every day with the latest taken snapshot, e.g. /.zfs/snapshot/auto-2026-09-26_00-00. I tried .zfs/snapshot/auto-$(date +%Y-%m-%d)_00-00 but that didn't work. Is it possible to pass the actual year, month and day to the backup path? |
Replies: 1 comment
|
Not in the path field itself: backrest passes the plan's paths to restic exactly as written, with no shell and no date expansion, so
Command hooks run through One thing to expect: because the path is different every day, restic treats every file as new and reads all of them again, even with a parent snapshot. It only stores what actually changed, so the repository does not grow more than usual, and retention is unaffected since backrest groups the plan's snapshots by its tag rather than by path, but each run takes as long as a first backup in disk reads. I checked it with restic 0.19.1: backing up the same files under a new directory name reported every file as If the reads matter, mount the day's snapshot at a fixed path in the same hook ( |
Not in the path field itself: backrest passes the plan's paths to restic exactly as written, with no shell and no date expansion, so
$(date ...)stays literal. You can get the same result with a hook and restic's--files-from, and backrest (1.13.0 and later) allows a plan with no paths when the backup flags supply them (its validation says "unless backup_flags supplies paths, e.g. --files-from").Add a hook to the plan: type Command, condition CONDITION_SNAPSHOT_START (it runs before restic starts), error behavior ON_ERROR_CANCEL, with a script that writes the newest snapshot directory to a file and fails if there is none: