Add a script that allows software RAID sets to be created before file
systems are mounted. An example set of entries for /etc/rc.conf: ataraid_enable="YES" ataraid_devices="ar0" ataraid_ar0_set="ad2 ad3" ataraid_ar0_type="RAID1" Because there is no "correct" way of doing ATA raid (ie, geom vs. atacontrol vs. vinum) that is bikeshed proof, this rcng script stays within the bounds of atacontrol and assumes that other RAID solutions for GEOM or vinum will end up in a different rcNG script. Reviewed by: green
This commit is contained in:
parent
86e1c22aa4
commit
7e6b2a1467
@ -53,6 +53,18 @@ netfs_types="nfs:NFS smbfs:SMB portalfs:PORTAL nwfs:NWFS" # Net filesystems.
|
||||
extra_netfs_types="NO" # List of network extra filesystem types for delayed
|
||||
# mount at startup (or NO).
|
||||
|
||||
# ATA RAID support for startup
|
||||
# Example config for a RAID1 set:
|
||||
# ataraid_ar0_set="ad2 ad3" # Creates the RAID set from these drives
|
||||
# ataraid_ar0_type="RAID1" # RAID type for ar0
|
||||
ataraid_create_flags="create" # Flags needed to create a RAID set.
|
||||
ataraid_delete_flags="delete" # Flags needed to delete a RAID set.
|
||||
ataraid_status_flags="status" # Flags needed to get the status on a RAID set.
|
||||
ataraid_devices="" # List of the ata RAID devices. ex: "ar0"
|
||||
ataraid_enable="NO" # Enable software ATA raid support
|
||||
ataraid_program="/sbin/atacontrol" # Path to ata raid program.
|
||||
|
||||
|
||||
##############################################################
|
||||
### Network configuration sub-section ######################
|
||||
##############################################################
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
FILES= DAEMON LOGIN NETWORKING SERVERS \
|
||||
abi accounting addswap adjkerntz amd \
|
||||
apm apmd archdep atm1 atm2 atm3 \
|
||||
apm apmd archdep ataraid atm1 atm2 atm3 \
|
||||
bgfsck bootparams \
|
||||
ccd cleanvar cleartmp cron \
|
||||
devd devfs dhclient diskless \
|
||||
|
113
etc/rc.d/ataraid
Normal file
113
etc/rc.d/ataraid
Normal file
@ -0,0 +1,113 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2003 The FreeBSD Project. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE PROJECT ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# PROVIDE: ataraid
|
||||
# REQUIRE: root
|
||||
# KEYWORD: FreeBSD
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="ataraid"
|
||||
precmd_cmd="ataraid_precmd"
|
||||
rcvar="`set_rcvar`"
|
||||
start_cmd="ataraid_start"
|
||||
status_cmd="ataraid_status"
|
||||
stop_cmd="ataraid_stop"
|
||||
|
||||
init_variables()
|
||||
{
|
||||
_r="$1"
|
||||
|
||||
if [ -z "$_r" ]; then
|
||||
warn "init_variables: you must specify an ata device"
|
||||
return
|
||||
fi
|
||||
|
||||
eval ataraid_set=\"\$ataraid_${_r}_set\"
|
||||
eval ataraid_type=\"\$ataraid_${_r}_type\"
|
||||
}
|
||||
|
||||
|
||||
ataraid_precmd()
|
||||
{
|
||||
if [ -z "${ataraid_program}" ]; then
|
||||
warn "ataraid_common: an ataraid program must be specified"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "${ataraid_create_flags}" ]; then
|
||||
warn "ataraid_common: an ataraid create flag must be specified"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "${ataraid_delete_flags}" ]; then
|
||||
warn "ataraid_common: an ataraid delete flag must be specified"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "${ataraid_status_flags}" ]; then
|
||||
warn "ataraid_common: an ataraid status flag must be specified"
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
ataraid_start()
|
||||
{
|
||||
echo -n "Creating ATA RAID sets: "
|
||||
for _raidev in ${ataraid_devices}
|
||||
do
|
||||
init_variables $_raidev
|
||||
${ataraid_program} ${ataraid_create_flags} ${ataraid_type} ${ataraid_set} > /dev/null
|
||||
echo -n "$_raidev"
|
||||
done
|
||||
echo '.'
|
||||
}
|
||||
|
||||
ataraid_status()
|
||||
{
|
||||
for _raidev in ${ataraid_devices}
|
||||
do
|
||||
init_variables $_raidev
|
||||
${ataraid_program} ${ataraid_status_flags} ${_raidev}
|
||||
done
|
||||
}
|
||||
|
||||
ataraid_stop()
|
||||
{
|
||||
echo -n "Tearing down ATA RAID sets: "
|
||||
for _raidev in ${ataraid_devices}
|
||||
do
|
||||
init_variables $_raidev
|
||||
${ataraid_program} ${ataraid_delete_flags} ${_raidev}
|
||||
echo -n "$_raidev"
|
||||
done
|
||||
echo '.'
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
|
||||
# PROVIDE: mountcritlocal
|
||||
# REQUIRE: root
|
||||
# REQUIRE: root ataraid
|
||||
# KEYWORD: FreeBSD NetBSD
|
||||
|
||||
. /etc/rc.subr
|
||||
|
Loading…
Reference in New Issue
Block a user