Merge commit 'refs/top-bases/linux-have-libdiskmgt' into linux-have-libdiskmgt

This commit is contained in:
Brian Behlendorf 2009-01-16 12:56:12 -08:00
commit c1542751c3
3 changed files with 106 additions and 33 deletions

View File

@ -1,2 +1,21 @@
#echo "${CMDDIR}/zpool/zpool create -f lustre ${DEVICES}" #!/bin/bash
#${CMDDIR}/zpool/zpool create -f lustre ${DEVICES} || exit 1 #
# 5 Device Loopback Raid-0 Configuration
#
DEVICES="/tmp/zpool-vdev0 \
/tmp/zpool-vdev1 \
/tmp/zpool-vdev2 \
/tmp/zpool-vdev3 \
/tmp/zpool-vdev4"
for DEV in ${DEVICES}; do
local DEV_LO=`/sbin/losetup -f`
rm -f ${DEV} || exit 1
dd if=/dev/zero of=${DEV} bs=1024k count=512 || exit 1
losetup ${DEV_LO} ${DEV} || exit 1
done
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} || exit 1

View File

@ -0,0 +1,15 @@
#!/bin/bash
#
# Sun Fire x4550 (Thumper) Raid-0 Configuration
#
DEVICES="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf \
/dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl \
/dev/sdm /dev/sdn /dev/sdo /dev/sdp /dev/sdq /dev/sdr \
/dev/sds /dev/sdt /dev/sdu /dev/sdv /dev/sdw /dev/sdx \
/dev/sdy /dev/sdz /dev/sdaa /dev/sdab /dev/sdac /dev/sdad \
/dev/sdae /dev/sdaf /dev/sdag /dev/sdah /dev/sdai /dev/sdaj \
/dev/sdak /dev/sdal /dev/sdam /dev/sdan /dev/sdao /dev/sdap \
/dev/sdaq /dev/sdar /dev/sdas /dev/sdat /dev/sdau /dev/sdav"
${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} || exit 1

View File

@ -3,37 +3,76 @@
. ./common.sh . ./common.sh
PROG=create-zpool.sh PROG=create-zpool.sh
# Device list, e.g. usage() {
# cat << EOF
# Single device USAGE:
#DEVICES="/dev/sda" $0 [hvcp]
#
# All disks in a Sun Thumper/Thor
#DEVICES="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf \
# /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl \
# /dev/sdm /dev/sdn /dev/sdo /dev/sdp /dev/sdq /dev/sdr \
# /dev/sds /dev/sdt /dev/sdu /dev/sdv /dev/sdw /dev/sdx \
# /dev/sdy /dev/sdz /dev/sdaa /dev/sdab /dev/sdac /dev/sdad \
# /dev/sdae /dev/sdaf /dev/sdag /dev/sdah /dev/sdai /dev/sdaj \
# /dev/sdak /dev/sdal /dev/sdam /dev/sdan /dev/sdao /dev/sdap \
# /dev/sdaq /dev/sdar /dev/sdas /dev/sdat /dev/sdau /dev/sdav"
#
# Promise JBOD config
#DEVICES="/dev/sdb /dev/sdc /dev/sdd \
# /dev/sde /dev/sdf /dev/sdg \
# /dev/sdh /dev/sdi /dev/sdj \
# /dev/sdk /dev/sdl /dev/sdm"
#
DEVICES=""
echo DESCRIPTION:
echo "zpool create zpios <devices>" Create one of several predefined zpool configurations.
${CMDDIR}/zpool/zpool create -F zpios ${DEVICES}
OPTIONS:
-h Show this message
-v Verbose
-c Zpool configuration
-p Zpool name
EOF
}
check_config() {
if [ ! -f ${ZPOOL_CONFIG} ]; then
local NAME=`basename ${ZPOOL_CONFIG} .cfg`
ERROR="Unknown config '${NAME}', available configs are:\n"
for CFG in `ls ${TOPDIR}/scripts/zpool-config/`; do
local NAME=`basename ${CFG} .cfg`
ERROR="${ERROR}${NAME}\n"
done
return 1
fi
return 0
}
ZPOOL_CONFIG=zpool_config.cfg
ZPOOL_NAME=tank
while getopts 'hvc:p:' OPTION; do
case $OPTION in
h)
usage
exit 1
;;
v)
VERBOSE=1
;;
c)
ZPOOL_CONFIG=${TOPDIR}/scripts/zpool-config/${OPTARG}
;;
p)
ZPOOL_NAME=${OPTARG}
;;
?)
usage
exit
;;
esac
done
check_config || die "${ERROR}"
. ${ZPOOL_CONFIG}
if [ ${VERBOSE} ]; then
echo echo
echo "zpool list" echo "zpool list"
${CMDDIR}/zpool/zpool list ${CMDDIR}/zpool/zpool list || exit 1
echo echo
echo "zpool status zpios" echo "zpool status ${ZPOOL_NAME}"
${CMDDIR}/zpool/zpool status zpios ${CMDDIR}/zpool/zpool status ${ZPOOL_NAME} || exit 1
}
exit 0