Add scripts for making snapshots of LVs with dm-snapshot even when those LVs reside...
[invirt/scripts/pv-fixup.git] / cheap-unsnapshot.sh
diff --git a/cheap-unsnapshot.sh b/cheap-unsnapshot.sh
new file mode 100644 (file)
index 0000000..73feccd
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+set -x
+
+BASE="$1"
+BASEDUP="basedup"
+ORIGIN="origin"
+TOP="top"
+
+[ -e "/dev/mapper/$BASE" ] || exit 1
+
+dmsetup suspend $BASE
+dmsetup remove $TOP
+dmsetup remove $ORIGIN
+dmsetup table $BASEDUP | dmsetup load $BASE
+dmsetup resume $BASE