zfs/scripts/zpool-config/md0-raid10.sh

33 lines
829 B
Bash

#!/bin/bash
#
# Four disk Raid-10 in a single Raid-0 Configuration
#
MDADM=${MDADM:-/sbin/mdadm}
MDDEVICES=${MDDEVICES:-"/dev/sd[abcd]"}
MDCOUNT=${MDCOUNT:-4}
MDRAID=${MDRAID:-10}
DEVICES="/dev/md0"
zpool_create() {
msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \
--raid-devices=${MDCOUNT} ${MDDEVICES}
${MDADM} --create ${DEVICES} --level=${MDRAID} \
--raid-devices=${MDCOUNT} ${MDDEVICES} || exit 1
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 2
}
zpool_destroy() {
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME} || exit 1
msg ${MDADM} --manage --stop ${DEVICES}
${MDADM} --manage --stop ${DEVICES} || exit 2
msg ${MDADM} --zero-superblock ${MDDEVICES}
${MDADM} --zero-superblock ${MDDEVICES} || exit 3
}