Simple backup solution for the PiServer
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
| sample-config.toml | ||
I switched to Btrbk, this repository is now archived.
PiServer Backup
PiServer Backup is a simple backup solution initially written for Raspberry Pi server. However, it should work on other unix platforms as well.
The software will create a backup archive which looks like this:
<destination>
+-- 2021-04-02t07-00-12+0200
| +-- mariadb
| | +-- ...
| +-- boot
| | +-- ...
| +-- root
| | +-- ...
| +-- data
| | +-- ...
+-- 2021-04-01t19-00-08+0200
| +-- mariadb
| | +-- ...
| +-- boot
| | +-- ...
| +-- root
| | +-- ...
| +-- data
| | +-- ...
...
The backup process contains the following steps:
- running
preofbackup_hooks(used e.g. for mounting a backup volume) - running
preofsnapshot_hooks - taking snapshots of
[[sources]](fortype = "rsync"this means copying) - running
postofsnapshot_hooks(in reversed order) - saving snapshots to
destination, cleaning up snapshots - cleaning up old backups
- running
postofbackup_hooks(in reversed order)
In case of errors the software tries to restore a clean state. This means:
- For every successful
preof a hook the correspondingpostis run. The only exception are critical hooks, if one of them fails the program will exit immediately. This setting is probably not useful forsnapshot_hooks. - Snapshots will be taken only if
preof all hooks succeeded. - If taking a snapshot fails, no snapshots will be saved but the successfully taken snapshots will be cleaned.
- Old backups will only be cleaned if saving the snapshots succeeded.
For convenience (and in order to make debugging easier) new backups are named
<date>.in-progress. Such a folder is created at the end of step 1 and
renamed to <date> just at the beginning of step 6.
TODO
- CI
- Proper SMTP configuration
- btrfs sources
- doc strings
- unit testing