#!/bin/sh test -f /proc/mdstat || exit 1 . /etc/init.d/functions # Detect that this system uses RAID via raidtools RAIDSTOP=/sbin/raidstop if [ ! -x "$RAIDSTOP" -o ! -f /etc/raidtab ]; then RAIDSTOP= ; fi # Detect that this system uses RAID via mdadm MDADM= for p in /sbin /usr/sbin; do if [ -x "$p/mdadm" ]; then MDADM="$p/mdadm" break fi done if [ -n "$MDADM" ]; then test -f "/etc/mdadm.conf" || MDADM= ; fi if [ -n "$MDADM" ]; then grep -s '^[^#]' /etc/mdadm.conf | grep -qs '[^[:space:]]' || MDADM= ; fi if [ -n "$MDADM" ]; then RAIDSTOP="$MDADM --stop" ; fi # Let's do that job.. test -n "$RAIDSTOP" || exit 1 mddevs=$(grep ^md /proc/mdstat | awk '{ print $1 }') for mddev in $mddevs ; do action "Turning off RAID for $mddev:" $RAIDSTOP "/dev/$mddev" done ## EOF ##