baikal: add server config

This commit is contained in:
Jef Roosens 2024-02-13 09:41:35 +01:00
parent ef8f5da37d
commit 35de046d69
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
8 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
data_dir='/mnt/data1/baikal'
snapshot_dir="${data_dir}.snapshot"
# Read-only snapshot for atomic backup
btrfs subvolume snapshot -r "$data_dir" "$snapshot_dir" || exit $?
/usr/local/bin/restic backup "$snapshot_dir"
# Always remove snapshot subvolume, even if restic fails
btrfs subvolume delete "$snapshot_dir"