summarylogtreecommitdiffstats
path: root/mdadm_udev_hook
diff options
context:
space:
mode:
authorChris Severance2015-08-06 20:08:49 -0400
committerChris Severance2015-08-06 20:08:49 -0400
commit9cb75f5911d134cb7951fe7357719e08488eb014 (patch)
treed3250acdd00a2f295491a48aee56a318cf14ccab /mdadm_udev_hook
parent25d098eed60e348733a3b89561e33b16d568dab5 (diff)
downloadaur-9cb75f5911d134cb7951fe7357719e08488eb014.tar.gz
Improved PKGBUILD install, mdadm_udev_hook
Diffstat (limited to 'mdadm_udev_hook')
-rw-r--r--mdadm_udev_hook18
1 files changed, 18 insertions, 0 deletions
diff --git a/mdadm_udev_hook b/mdadm_udev_hook
new file mode 100644
index 000000000000..895cadd16241
--- /dev/null
+++ b/mdadm_udev_hook
@@ -0,0 +1,18 @@
+#!/usr/bin/bash
+
+# This hook doesn't do anything except echo the status lines that the old mdadm hook did.
+# Started md1 with 2 of 2 devices [UU]
+
+# First made for Arch Linux AUR package mdadm-git
+
+run_hook() {
+ # bash -c 'source mdadm_udev_hook; run_hook'
+ # http://unix.stackexchange.com/questions/28636/how-to-check-mdadm-raids-while-running
+ # awk puts the 2 lines together. sed outputs the formatted text
+ awk '/^md/ {printf "%s: ", $1}; /blocks/ {print $0 }' < '/proc/mdstat' | sed -ne 's;^\(.\+\):.*\[\([0-9]\+\)\/\([0-9]\+\)\].*\(\[[^]]*\]\).*$;Started \1 with \2 of \3 devices \4;p' | sort
+ #sleep 1
+ if ! /usr/bin/mdadm -D --scan >/dev/null; then
+ echo 'A RAID array may be damaged. Review /proc/mdstat and fix soon!'
+ sleep 5
+ fi
+}