diff options
| author | doc <doc@filenotfound.org> | 2025-10-01 20:35:47 +0000 |
|---|---|---|
| committer | doc <doc@filenotfound.org> | 2025-10-01 20:35:47 +0000 |
| commit | 772152a5810aa8c4e03cf167381aadc4ec00499f (patch) | |
| tree | ba9418142f88622da878d9a3483c5da2da3e5c83 /rebootvalidate.sh | |
| parent | 13eb2d51c7284472efabc278bf9b7ec0b8575e47 (diff) | |
Diffstat (limited to 'rebootvalidate.sh')
| -rwxr-xr-x | rebootvalidate.sh | 51 |
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 |
