Refactor persistence structure
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
|
Reference in New Issue
Block a user