diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2015-08-07 16:13:45 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2015-08-07 16:13:45 +0200 |
commit | 14852322c853c0e4e2467bcc3cb45bc32bb8911a (patch) | |
tree | cd28953f76b70a3ed335013e30dca125b958f969 | |
parent | 02065d1d50ad2fa0afb9d3e970a56b99e8e38077 (diff) | |
download | bin-14852322c853c0e4e2467bcc3cb45bc32bb8911a.tar.xz |
Add btrfs snapshot script
-rwxr-xr-x | snapshot | 15 |
1 files changed, 15 insertions, 0 deletions
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 |