Restic is a great backup tool, but has some limitations:
- insufficent btrfs support: one cannot backup a whole filesystem with subvolumes
- no full backup of all local filesystems (all-in-one)
- no support for chattr file attributes
- no snapshot consistency
- no default exclude list
To overcome these limitations and inspired by IBM Storage Protect (TSM) I have written the restic wrapper script restix-backup which also automatically deletes old backups:
restix-backup: save a snapshot with all file attributes, prune and check
usage: restix-backup [-v] [-n] [-f] [-x] [-X] [-Z] [-K] [-k DAYS,WEEKS] [-t TAG] [-H] [-e 'PATTERN'] DIRECTORY [...]
options: -v verbose output
-n no action, dry run
-f use fsfreeze in second run to suspend writes to the filesystem
-x do not cross filesystem boundaries
-X do not save chattr extended file attributes
-Z do not check the repository for errors
-K keep all snapshots, no auto-delete (forget+prune)
-k keep DAYS daily and WEEKS weekly snapshots (default: 7,4)
-t store snapshot with TAG
-H prefix TAG with hostname
-e exclude files with sh PATTERN, may be repeated
-h show help
example: keep 10 daily and 8 weekly snapshots
restix-backup -k 10,8 /
example: keep all snapshots, store with "extra" tag
restix-backup -K -t extra /opt /sw
example: exclude "tmp" and "cache" directories
restix-backup -e tmp -e cache /home
If DIRECTORY is / then subvolumes are included but no other filesystems.
If DIRECTORY is // then all filesystems(*) are saved in one snapshot.
If DIRECTORY is /// then snapshots of all filesystems(*) are saved.
(*) filesystem must be rw mounted and of type ext2 ext3 ext4 xfs btrfs
restix-backup respects /root/.restic/exclude
restix-backup saves only one snapshot per day (most recent).
restix-backup saves chattr file attributes in DIRECTORY/.chattr
restix-backup -H is necessary when multiple hosts use a common repository.
restix-backup cannot handle filenames with newline character correctly.
restix-restore restores files with chattr attributes if available.
See restix