Simple backup solution for the PiServer
Find a file
2024-12-03 23:38:26 +01:00
src Code style improvement 2021-09-02 08:03:55 +02:00
.gitignore Initial implementation in rust 2021-04-03 19:55:34 +02:00
Cargo.lock v1.0.1 2021-09-02 08:04:37 +02:00
Cargo.toml v1.0.1 2021-09-02 08:04:37 +02:00
LICENSE Release! 2021-04-04 16:02:16 +02:00
README.md Archive repo 2024-12-03 23:38:26 +01:00
sample-config.toml Fix mark for deletion algorithm 2021-08-31 16:19:06 +02:00

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:

  1. running pre of backup_hooks (used e.g. for mounting a backup volume)
  2. running pre of snapshot_hooks
  3. taking snapshots of [[sources]] (for type = "rsync" this means copying)
  4. running post of snapshot_hooks (in reversed order)
  5. saving snapshots to destination, cleaning up snapshots
  6. cleaning up old backups
  7. running post of backup_hooks (in reversed order)

In case of errors the software tries to restore a clean state. This means:

  • For every successful pre of a hook the corresponding post is run. The only exception are critical hooks, if one of them fails the program will exit immediately. This setting is probably not useful for snapshot_hooks.
  • Snapshots will be taken only if pre of 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