You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
648 B

5 years ago
#!/usr/bin/env bash
help() {
echo "USAGE: makeraid [name] [md-name] [level] [device] [device] ... [ [--spares] [device] ... ]"
5 years ago
}
NAME="${1}"; shift
MDNM="${1}"; shift
[[ :0:1:4:5:6:10: == *:${1}:* ]] && RDDVLV=${1} || { help; exit 1; }
5 years ago
shift
until [ "${1}" = "--spares" ]; do
[ -b "${1}" ] && RDDV+=("${1}") || { help; exit 2; }
5 years ago
shift
[ ${#} = 0 ] && break
5 years ago
done
if [ "${1}" == "--spares" ]; then
shift
for DV in ${@}; do
SPDV+=("${DV}")
5 years ago
done
fi
[ "${#SPDV[@]}" -gt "0" ] && SPOP=( "-x" "${#SPDV[@]}" )
5 years ago
mdadm -ve 1.2 -C "/dev/md/${MDNM}" -N "any:${NAME}" -l "${RDDVLV}" -c 32 -n ${#RDDV[@]} ${RDDV[@]} ${SPOP[@]} ${SPDV[@]}