File: raid

package info (click to toggle)
raidtools 0.42-16
  • links: PTS
  • area: main
  • in suites: slink
  • size: 392 kB
  • ctags: 128
  • sloc: ansic: 2,056; makefile: 134; sh: 107
file content (56 lines) | stat: -rw-r--r-- 1,354 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /bin/sh
# raid		Enable or disable multiple devices. If /etc/mdtab doesn't
#		exist or is empty we don't bother; likewise if mdadd or
#		mdstop isn't installed.
#
#		Note that since this is called early in the bootprocess you
#		can't swap to an MD device; but you don't want to do that
#		anyway as the Linux kernel can stripe swap partitions
#		itself (see swapon manpage).
#
# Version:	@(#)md  2.73  08-Jan-1998  miquels@cistron.nl
#

case "$1" in
	start|"")
		if [ -s /etc/mdtab -a -f /sbin/mdadd ]
		then
			[ "$VERBOSE" != no ] && echo "Adding md devices."
			mdadd -ar

			if [ $? -ne 0 -a -d /etc/raid -a -x /sbin/ckraid ]; then
			    echo "Some of the RAID devices have errors:"
			    for conf in /etc/raid/*.conf; do
				echo "  Checking \"`echo $conf | sed 's?.*/\([^/]*\).conf?\1?'`\":"
				ckraid --fix $conf
				
			    done
			    mdstop -a
			    mdadd -ar
			    if [ $? -ne 0 ]; then
			        echo "  WARNING: unrecovered RAID errors!"
			    fi
			fi

		fi
		: ;;
	stop)
		if [ -r /etc/mdtab -a -x /sbin/mdstop ]
		then
			[ "$VERBOSE" != no ] && echo "Stopping md devices."
        		mdstop -a
		fi
		: ;;
	reload)
		echo "Reload not possible, use restart."
		;;
	restart|force-reload)
		/etc/init.d/raid stop
		/etc/init.d/raid start
		;;
	*)
		echo "Usage: raid (start|stop|reload|restart|force-reload" >&2
		false
		;;
esac