petit script shell de gestion de backups via RSync et btrfs.
Elisa c004a53a3a
Automatically remove empty backup dirs
9 months ago Automatic monthly trim of half the old backups 9 months ago Automatically remove empty backup dirs 9 months ago

Btrfs and rsync - based backup system


  • btrfs file system (and therefore btrfs-progs)
  • rsync
  • root access (either directly or via sudo)


/path/to/base/dir ├─ └─BkpTargetDir ├─ignore.lst: list of ignored subdirs/files (shell wild cards accepted), optional ├─sources.lst: source directory(ies) to backup from (can be over ssh, and can be multiple) └─YYYY


How to make a (new) backup

Just run with the BkpTargetDir as argument (you can specify many at once).

If there is no backup yet, it will create a sub-volume, or else it will first make a snapshot of the previous sub-volume (the most recent one) and rsync on top of it, so that only modified blocks will be saved onto the disk, and the whole tree is entirely accessible via standard system tools (file manager, ls / cd, etc).

Watch out for owner/group : if rsync needs to chown files after syncing them (multiple trees with different owners, a file system root for example) you will absolutely need to run the script as root.

Otherwise, if you have total write permission on the file system, you'll be able to make sub-volumes and snapshot as if they were normal directories (but not delete them).