aboutsummaryrefslogtreecommitdiffstats
path: root/rrolback
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2017-10-11 23:36:34 -0400
committerBrian Cully <bjc@kublai.com>2017-10-12 00:01:17 -0400
commitb6e77390279ca0b5ae4953df8f651311420f6238 (patch)
tree95c91c179d3ca2b62fe5922213133cc740441d93 /rrolback
downloadzfs-scripts-b6e77390279ca0b5ae4953df8f651311420f6238.tar.gz
zfs-scripts-b6e77390279ca0b5ae4953df8f651311420f6238.zip
Initial commit.
Diffstat (limited to 'rrolback')
-rwxr-xr-xrrolback20
1 files changed, 20 insertions, 0 deletions
diff --git a/rrolback b/rrolback
new file mode 100755
index 0000000..7a83aa8
--- /dev/null
+++ b/rrolback
@@ -0,0 +1,20 @@
+#!/usr/bin/bash
+#
+# Dr. Martin Menzel
+# Dr. Menzel IT - www.dr-menzel-it.de
+# 11.08.2013
+#
+# Use at your own risk. No warranty. No fee.
+#
+# parameter list:
+# (1) the filesystem to be used to start decendant recursion
+# example: apool/zones/webzone
+# (2) the snapshot to which the filesystems should be rolled back
+# example: @2013-07-21-083500
+#
+for snap in `zfs list -H -t snapshot -r $1 | grep "$2" | cut -f 1`; do
+ # -r : also destroys the snapshots newer than the specified one
+ # -R : also destroys the snapshots newer than the one specified and their clones
+ # -f : forces an unmount of any clone file systems that are to be destroyed
+ echo -n "rolling back to [$snap] : ";zfs rollback -r -R -f $snap; echo " Done."
+done