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

README.md

Bkp.sh

Btrfs and rsync - based backup system

Requirements

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

Layout

/path/to/base/dir ├─bkp.sh └─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

└─mm
  └─dd
    ├─HH:MM:SS
    └─HH:MM:SS

How to make a (new) backup

Just run bkp.sh 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).