summaryrefslogtreecommitdiff
blob: 7a12fee370c9de2413051480a998eb792209be2d (plain)
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
# /lib/rcscripts/addons/raid-start.sh:  Setup raid volumes at boot
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-fs/mdadm/files/raid-start.sh-3.0,v 1.1 2009/08/23 11:19:38 vapier Exp $

[ -f /proc/mdstat ] || exit 0

# Start software raid with mdadm (new school)
mdadm_conf="/etc/mdadm/mdadm.conf"
[ -e /etc/mdadm.conf ] && mdadm_conf="/etc/mdadm.conf"
if [ -x /sbin/mdadm -a -f "${mdadm_conf}" ] ; then
	devs=$(awk '/^[[:space:]]*ARRAY/ { print $2 }' "${mdadm_conf}")
	if [ -n "${devs}" ]; then
		ebegin "Starting up RAID devices"
		output=$(mdadm -As 2>&1)
		ret=$?
		[ ${ret} -ne 0 ] && echo "${output}"
		eend ${ret}
	fi
fi

partitioned_devs=$(ls /dev/md_d* 2>/dev/null)
if [ -n "${partitioned_devs}" ]; then
	ebegin "Creating RAID device partitions"
	/sbin/blockdev ${partitioned_devs}
	eend 0
	# wait because vgscan runs next, and we want udev to fire
	sleep 1
fi

# vim:ts=4