From 14852322c853c0e4e2467bcc3cb45bc32bb8911a Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Fri, 7 Aug 2015 16:13:45 +0200 Subject: Add btrfs snapshot script --- snapshot | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 snapshot (limited to 'snapshot') diff --git a/snapshot b/snapshot new file mode 100755 index 0000000..ae6a231 --- /dev/null +++ b/snapshot @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +create_snapshot() { + sudo btrfs subvolume snapshot -r "$1" "$2" && + printf "==> Successfully created a snaphot of %s in %s\n" "$1" "$2" || + printf "==> Failet to create a snaphot of %s in %s\n" "$1" "$2" +} + +SNAPSHOTS=/snapshots +SNAPDIR="$SNAPSHOTS"/"$(date +%Y-%m-%dT%H:%M:%S%z)" +printf "==> Creating snapshots in %s\n" "$SNAPDIR" + +sudo mkdir "$SNAPDIR" +create_snapshot / "$SNAPDIR"/root +create_snapshot /home "$SNAPDIR"/home -- cgit v1.2.3-54-g00ecf