summaryrefslogtreecommitdiff
path: root/rebootvalidate.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rebootvalidate.sh')
-rwxr-xr-xrebootvalidate.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/rebootvalidate.sh b/rebootvalidate.sh
new file mode 100755
index 0000000..f6506e6
--- /dev/null
+++ b/rebootvalidate.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+# rebootvalidate.sh - Validate ZFS pools, datasets, and bind mounts after reboot
+
+# === CONFIG ===
+# List the bind mount TARGETS you expect to be present under /mnt/brimstone/mirror
+EXPECTED_BINDS=(
+ "/mnt/brimstone/mirror/archlinux"
+ "/mnt/brimstone/mirror/rocky"
+ "/mnt/brimstone/mirror/debian"
+ "/mnt/brimstone/mirror/slackware"
+ "/mnt/brimstone/mirror/gentoo"
+ "/mnt/brimstone/mirror/hardenedbsd"
+ "/mnt/brimstone/mirror/void"
+ "/mnt/brimstone/mirror/crux"
+ "/mnt/brimstone/mirror/alma"
+ "/mnt/brimstone/mirror/kitten"
+)
+
+echo "=== Checking ZFS Pools ==="
+zpool status | grep -E "pool|state|errors"
+if zpool status | grep -q "ONLINE"; then
+ echo "[OK] All pools appear ONLINE."
+else
+ echo "[WARN] Some pools are not ONLINE."
+fi
+echo
+
+echo "=== Checking ZFS Datasets ==="
+zfs list -o name,mountpoint,mounted | grep -v "legacy"
+if zfs list -o mounted | grep -q "no"; then
+ echo "[WARN] One or more datasets are not mounted."
+else
+ echo "[OK] All datasets mounted."
+fi
+echo
+
+echo "=== Checking Bind Mounts ==="
+for target in "${EXPECTED_BINDS[@]}"; do
+ if findmnt -no TARGET,SOURCE "$target" >/tmp/mntcheck 2>/dev/null; then
+ tgt=$(awk '{print $1}' /tmp/mntcheck)
+ src=$(awk '{print $2}' /tmp/mntcheck)
+
+ if [[ "$tgt" == "$target" ]]; then
+ echo "[OK] $target is bound to $src"
+ else
+ echo "[FAIL] $target exists but unexpected source: $src"
+ fi
+ else
+ echo "[FAIL] Missing bind mount: $target"
+ fi
+done