Refactor persistence structure

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-05-26 11:47:21 +01:00
parent b631d466ff
commit 19285a264f
48 changed files with 196 additions and 145 deletions

View File

@@ -11,7 +11,7 @@ usage() {
}
cleanup() {
if [ -d "/persist.bak" ]; then btrfs -q subvolume delete "/persist.bak"; fi
if [ -d "/persist/user.bak" ]; then btrfs -q subvolume delete "/persist/user.bak"; fi
if [ -n "$backup_location" ]; then rm -f "$backup_location.tmp"; fi
if [ -n "$mount_location" ]; then
@@ -56,11 +56,11 @@ fi
backup_location="$backup_location/$(hostname)-$(date +%Y-%m-%d-%H-%M-%S).btrfs.gz"
echo "Creating /persist snapshot..."
btrfs -q subvolume snapshot -r "/persist" "/persist.bak"
echo "Creating /persist/user snapshot..."
btrfs -q subvolume snapshot -r "/persist/user" "/persist/user.bak"
echo "Creating backup at $backup_location..."
btrfs -q send "/persist.bak" | gzip > "$backup_location.tmp"
btrfs -q send "/persist/user.bak" | gzip > "$backup_location.tmp"
mv "$backup_location.tmp" "$backup_location"