diff options
author | Brian Behlendorf <[email protected]> | 2010-08-26 11:22:58 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2010-08-31 13:41:27 -0700 |
commit | c9c0d073da561bcbefbdf09c87fc75b227415619 (patch) | |
tree | 7daee55ae61526107f421de48171573fa5a15d28 /scripts/zpool-config | |
parent | 40b84e7aec6392187722e61e5a4a853b530bf60f (diff) |
Add build system
Add autoconf style build infrastructure to the ZFS tree. This
includes autogen.sh, configure.ac, m4 macros, some scripts/*,
and makefiles for all the core ZFS components.
Diffstat (limited to 'scripts/zpool-config')
26 files changed, 734 insertions, 0 deletions
diff --git a/scripts/zpool-config/dm0-raid0.sh b/scripts/zpool-config/dm0-raid0.sh new file mode 100644 index 000000000..89f66e73a --- /dev/null +++ b/scripts/zpool-config/dm0-raid0.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Four disk Raid-0 DM in a single Raid-0 Configuration +# + +PVCREATE=${PVCREATE:-/sbin/pvcreate} +PVREMOVE=${PVREMOVE:-/sbin/pvremove} +PVDEVICES=${PVDEVICES:-"/dev/sd[abcd]"} + +VGCREATE=${VGCREATE:-/sbin/vgcreate} +VGREMOVE=${VGREMOVE:-/sbin/vgremove} +VGNAME=${VGNAME:-"vg_tank"} + +LVCREATE=${LVCREATE:-/sbin/lvcreate} +LVREMOVE=${LVREMOVE:-/sbin/lvremove} +LVNAME=${LVNAME:-"lv_tank"} +LVSTRIPES=${LVSTRIPES:-4} +LVSIZE=${LVSIZE:-32G} + +DEVICES="/dev/${VGNAME}/${LVNAME}" + +zpool_dm_destroy() { + msg ${LVREMOVE} -f ${VGNAME}/${LVNAME} + ${LVREMOVE} -f ${VGNAME}/${LVNAME} >/dev/null + + msg ${VGREMOVE} -f ${VGNAME} + ${VGREMOVE} -f ${VGNAME} >/dev/null + + msg ${PVREMOVE} ${PVDEVICES} + ${PVREMOVE} ${PVDEVICES} >/dev/null +} + +zpool_create() { + # Remove EFI labels which cause pvcreate failure + for DEVICE in ${PVDEVICES}; do + dd if=/dev/urandom of=${DEVICE} bs=1k count=32 &>/dev/null + done + + msg ${PVCREATE} -f ${PVDEVICES} + ${PVCREATE} -f ${PVDEVICES} >/dev/null || exit 1 + + msg ${VGCREATE} ${VGNAME} ${PVDEVICES} + ${VGCREATE} ${VGNAME} ${PVDEVICES} >/dev/null || exit 2 + + msg ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \ + --name=${LVNAME} ${VGNAME} + ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \ + --name=${LVNAME} ${VGNAME} >/dev/null || exit 3 + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + ${DEVICES} || (zpool_dm_destroy && exit 4) +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + zpool_dm_destroy +} diff --git a/scripts/zpool-config/dragon-raid0-1x70.sh b/scripts/zpool-config/dragon-raid0-1x70.sh new file mode 100644 index 000000000..dda995700 --- /dev/null +++ b/scripts/zpool-config/dragon-raid0-1x70.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Dragon (White Box) Raid-0 Configuration (1x70) +# + +RANKS=7 +CHANNELS=10 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.dragon.example + udev_raid0_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID0S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID0S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.dragon.example +} diff --git a/scripts/zpool-config/dragon-raid10-35x2.sh b/scripts/zpool-config/dragon-raid10-35x2.sh new file mode 100644 index 000000000..37f2a539a --- /dev/null +++ b/scripts/zpool-config/dragon-raid10-35x2.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Dragon (White Box) Raid-10 Configuration (35x2(1+1)) +# + +RANKS=7 +CHANNELS=10 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.dragon.example + udev_raid10_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID10S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID10S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.dragon.example +} diff --git a/scripts/zpool-config/dragon-raidz-7x10.sh b/scripts/zpool-config/dragon-raidz-7x10.sh new file mode 100644 index 000000000..9857cf1c0 --- /dev/null +++ b/scripts/zpool-config/dragon-raidz-7x10.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Dragon (White Box) Raid-Z Configuration (7x10(9+1)) +# + +RANKS=7 +CHANNELS=10 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.dragon.example + udev_raidz_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZS[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.dragon.example +} diff --git a/scripts/zpool-config/dragon-raidz2-7x10.sh b/scripts/zpool-config/dragon-raidz2-7x10.sh new file mode 100644 index 000000000..0dd07a19b --- /dev/null +++ b/scripts/zpool-config/dragon-raidz2-7x10.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Dragon (White Box) Raid-Z2 Configuration (7x10(8+2)) +# + +RANKS=7 +CHANNELS=10 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.dragon.example + udev_raidz2_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZ2S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.dragon.example +} diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh new file mode 100644 index 000000000..5ec80b05c --- /dev/null +++ b/scripts/zpool-config/file-raid0.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# 4 File Raid-0 Configuration +# + +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" + +zpool_create() { + for FILE in ${FILES}; do + msg "Creating ${FILE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + done + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${FILES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${FILES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + msg "Removing ${FILE}" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/file-raid10.sh b/scripts/zpool-config/file-raid10.sh new file mode 100644 index 000000000..ae7f0ae07 --- /dev/null +++ b/scripts/zpool-config/file-raid10.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# 4 File Raid-10 Configuration +# + +FILES_M1="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1" +FILES_M2="/tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" +FILES="${FILES_M1} ${FILES_M2}" + +zpool_create() { + for FILE in ${FILES}; do + msg "Creating ${FILE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + done + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + mirror ${FILES_M1} mirror ${FILES_M2} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + mirror ${FILES_M1} mirror ${FILES_M2} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + msg "Removing ${FILE}" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/file-raidz.sh b/scripts/zpool-config/file-raidz.sh new file mode 100644 index 000000000..5b6c3ea2c --- /dev/null +++ b/scripts/zpool-config/file-raidz.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# 4 File Raid-Z Configuration +# + +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" + +zpool_create() { + for FILE in ${FILES}; do + msg "Creating ${FILE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + done + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${FILES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${FILES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + msg "Removing ${FILE}" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/file-raidz2.sh b/scripts/zpool-config/file-raidz2.sh new file mode 100644 index 000000000..bc0e5ec8a --- /dev/null +++ b/scripts/zpool-config/file-raidz2.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# 4 File Raid-Z2 Configuration +# + +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" + +zpool_create() { + for FILE in ${FILES}; do + msg "Creating ${FILE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + done + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${FILES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${FILES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + msg "Removing ${FILE}" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/hda-raid0.sh b/scripts/zpool-config/hda-raid0.sh new file mode 100644 index 000000000..fb743fae5 --- /dev/null +++ b/scripts/zpool-config/hda-raid0.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Single disk /dev/hda Raid-0 Configuration +# + +DEVICES="/dev/hda" + +zpool_create() { + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 +} diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh new file mode 100644 index 000000000..321d9b1f7 --- /dev/null +++ b/scripts/zpool-config/lo-raid0.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# 4 Device Loopback Raid-0 Configuration +# + +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" +DEVICES="" + +zpool_create() { + for FILE in ${FILES}; do + DEVICE=`unused_loop_device` + msg "Creating ${FILE} using loopback device ${DEVICE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + ${LOSETUP} ${DEVICE} ${FILE} || + die "Error $? creating ${FILE} -> ${DEVICE} loopback" + DEVICES="${DEVICES} ${DEVICE}" + done + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` + msg "Removing ${FILE} using loopback device ${DEVICE}" + ${LOSETUP} -d ${DEVICE} || + die "Error $? destroying ${FILE} -> ${DEVICE} loopback" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/lo-raid10.sh b/scripts/zpool-config/lo-raid10.sh new file mode 100644 index 000000000..f9c47cd1e --- /dev/null +++ b/scripts/zpool-config/lo-raid10.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# 4 Device Loopback Raid-0 Configuration +# + +FILES_M1="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1" +FILES_M2="/tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" +FILES="${FILES_M1} ${FILES_M2}" +DEVICES_M1="" +DEVICES_M2="" + +zpool_create() { + for FILE in ${FILES_M1}; do + DEVICE=`unused_loop_device` + msg "Creating ${FILE} using loopback device ${DEVICE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + ${LOSETUP} ${DEVICE} ${FILE} || + die "Error $? creating ${FILE} -> ${DEVICE} loopback" + DEVICES_M1="${DEVICES_M1} ${DEVICE}" + done + + for FILE in ${FILES_M2}; do + DEVICE=`unused_loop_device` + msg "Creating ${FILE} using loopback device ${DEVICE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + ${LOSETUP} ${DEVICE} ${FILE} || + die "Error $? creating ${FILE} -> ${DEVICE} loopback" + DEVICES_M2="${DEVICES_M2} ${DEVICE}" + done + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + mirror ${DEVICES_M1} mirror ${DEVICES_M2} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + mirror ${DEVICES_M1} mirror ${DEVICES_M2} +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` + msg "Removing ${FILE} using loopback device ${DEVICE}" + ${LOSETUP} -d ${DEVICE} || + die "Error $? destroying ${FILE} -> ${DEVICE} loopback" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/lo-raidz.sh b/scripts/zpool-config/lo-raidz.sh new file mode 100644 index 000000000..509f6ee1d --- /dev/null +++ b/scripts/zpool-config/lo-raidz.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# 4 Device Loopback Raid-0 Configuration +# + +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" +DEVICES="" + +zpool_create() { + for FILE in ${FILES}; do + DEVICE=`unused_loop_device` + msg "Creating ${FILE} using loopback device ${DEVICE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + ${LOSETUP} ${DEVICE} ${FILE} || + die "Error $? creating ${FILE} -> ${DEVICE} loopback" + DEVICES="${DEVICES} ${DEVICE}" + done + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz ${DEVICES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` + msg "Removing ${FILE} using loopback device ${DEVICE}" + ${LOSETUP} -d ${DEVICE} || + die "Error $? destroying ${FILE} -> ${DEVICE} loopback" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/lo-raidz2.sh b/scripts/zpool-config/lo-raidz2.sh new file mode 100644 index 000000000..6e61293c0 --- /dev/null +++ b/scripts/zpool-config/lo-raidz2.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# 4 Device Loopback Raid-0 Configuration +# + +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" +DEVICES="" + +zpool_create() { + for FILE in ${FILES}; do + DEVICE=`unused_loop_device` + msg "Creating ${FILE} using loopback device ${DEVICE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=0 seek=256 \ + &>/dev/null || die "Error $? creating ${FILE}" + ${LOSETUP} ${DEVICE} ${FILE} || + die "Error $? creating ${FILE} -> ${DEVICE} loopback" + DEVICES="${DEVICES} ${DEVICE}" + done + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} raidz2 ${DEVICES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` + msg "Removing ${FILE} using loopback device ${DEVICE}" + ${LOSETUP} -d ${DEVICE} || + die "Error $? destroying ${FILE} -> ${DEVICE} loopback" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/md0-raid10.sh b/scripts/zpool-config/md0-raid10.sh new file mode 100644 index 000000000..ccc717015 --- /dev/null +++ b/scripts/zpool-config/md0-raid10.sh @@ -0,0 +1,38 @@ +#!/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_md_destroy() { + msg ${MDADM} --manage --stop ${DEVICES} + ${MDADM} --manage --stop ${DEVICES} &>/dev/null + + msg ${MDADM} --zero-superblock ${MDDEVICES} + ${MDADM} --zero-superblock ${MDDEVICES} >/dev/null +} + +zpool_create() { + msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \ + --raid-devices=${MDCOUNT} ${MDDEVICES} + ${MDADM} --create ${DEVICES} --level=${MDRAID} \ + --raid-devices=${MDCOUNT} ${MDDEVICES} \ + &>/dev/null || (zpool_md_destroy && exit 1) + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + ${DEVICES} || (zpool_md_destroy && exit 2) +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + zpool_md_destroy +} diff --git a/scripts/zpool-config/md0-raid5.sh b/scripts/zpool-config/md0-raid5.sh new file mode 100644 index 000000000..b5b22fe7a --- /dev/null +++ b/scripts/zpool-config/md0-raid5.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# Four disk Raid-5 in a single Raid-0 Configuration +# + +MDADM=${MDADM:-/sbin/mdadm} +MDDEVICES=${MDDEVICES:-"/dev/sd[abcd]"} +MDCOUNT=${MDCOUNT:-4} +MDRAID=${MDRAID:-5} + +DEVICES="/dev/md0" + +zpool_md_destroy() { + msg ${MDADM} --manage --stop ${DEVICES} + ${MDADM} --manage --stop ${DEVICES} &>/dev/null + + msg ${MDADM} --zero-superblock ${MDDEVICES} + ${MDADM} --zero-superblock ${MDDEVICES} >/dev/null +} + +zpool_create() { + msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \ + --raid-devices=${MDCOUNT} ${MDDEVICES} + ${MDADM} --create ${DEVICES} --level=${MDRAID} \ + --raid-devices=${MDCOUNT} ${MDDEVICES} \ + &>/dev/null || (zpool_md_destroy && exit 1) + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \ + ${DEVICES} || (zpool_md_destroy && exit 2) +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + + zpool_md_destroy +} diff --git a/scripts/zpool-config/ram0-raid0.sh b/scripts/zpool-config/ram0-raid0.sh new file mode 100644 index 000000000..b1939bfaa --- /dev/null +++ b/scripts/zpool-config/ram0-raid0.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Single ram disk /dev/ram0 Raid-0 Configuration +# + +DEVICES="/dev/ram0" + +zpool_create() { + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 +} diff --git a/scripts/zpool-config/sda-raid0.sh b/scripts/zpool-config/sda-raid0.sh new file mode 100644 index 000000000..b11092466 --- /dev/null +++ b/scripts/zpool-config/sda-raid0.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Single disk /dev/sda Raid-0 Configuration +# + +DEVICES="/dev/sda" + +zpool_create() { + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} || exit 1 +} diff --git a/scripts/zpool-config/supermicro-raid0-1x16.sh b/scripts/zpool-config/supermicro-raid0-1x16.sh new file mode 100644 index 000000000..efe48459d --- /dev/null +++ b/scripts/zpool-config/supermicro-raid0-1x16.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Supermicro (White Box) Raid-0 Configuration (1x16) +# + +RANKS=4 +CHANNELS=4 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.supermicro.example + udev_raid0_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID0S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID0S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.supermicro.example +} diff --git a/scripts/zpool-config/supermicro-raid10-8x2.sh b/scripts/zpool-config/supermicro-raid10-8x2.sh new file mode 100644 index 000000000..a6e6be6c0 --- /dev/null +++ b/scripts/zpool-config/supermicro-raid10-8x2.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Supermicro (White Box) Raid-10 Configuration (8x2(1+1)) +# + +RANKS=4 +CHANNELS=4 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.supermicro.example + udev_raid10_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID10S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID10S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.supermicro.example +} diff --git a/scripts/zpool-config/supermicro-raidz-4x4.sh b/scripts/zpool-config/supermicro-raidz-4x4.sh new file mode 100644 index 000000000..9ed2780e9 --- /dev/null +++ b/scripts/zpool-config/supermicro-raidz-4x4.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Supermicro (White Box) Raid-Z Configuration (4x4(3+1)) +# + +RANKS=4 +CHANNELS=4 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.supermicro.example + udev_raidz_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZS[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.supermicro.example +} diff --git a/scripts/zpool-config/supermicro-raidz2-4x4.sh b/scripts/zpool-config/supermicro-raidz2-4x4.sh new file mode 100644 index 000000000..ed3eedfdf --- /dev/null +++ b/scripts/zpool-config/supermicro-raidz2-4x4.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Supermicro (White Box) Raid-Z2 Configuration (4x4(2+2)) +# + +RANKS=4 +CHANNELS=4 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.supermicro.example + udev_raidz2_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZ2S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.supermicro.example +} diff --git a/scripts/zpool-config/x4550-raid0-1x48.sh b/scripts/zpool-config/x4550-raid0-1x48.sh new file mode 100644 index 000000000..16156aa09 --- /dev/null +++ b/scripts/zpool-config/x4550-raid0-1x48.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Sun Fire x4550 (Thumper/Thor) Raid-0 Configuration (1x48) +# + +RANKS=8 +CHANNELS=6 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.x4550.example + udev_raid0_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID0S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID0S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.x4550.example +} diff --git a/scripts/zpool-config/x4550-raid10-24x2.sh b/scripts/zpool-config/x4550-raid10-24x2.sh new file mode 100644 index 000000000..ec91f43e6 --- /dev/null +++ b/scripts/zpool-config/x4550-raid10-24x2.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Sun Fire x4550 (Thumper/Thor) Raid-10 Configuration (24x2(1+1)) +# + +RANKS=8 +CHANNELS=6 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.x4550.example + udev_raid10_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID10S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAID10S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.x4550.example +} diff --git a/scripts/zpool-config/x4550-raidz-8x6.sh b/scripts/zpool-config/x4550-raidz-8x6.sh new file mode 100644 index 000000000..ed31a80e6 --- /dev/null +++ b/scripts/zpool-config/x4550-raidz-8x6.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Sun Fire x4550 (Thumper/Thor) Raid-Z Configuration (8x6(5+1)) +# + +RANKS=8 +CHANNELS=6 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.x4550.example + udev_raidz_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZS[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZS[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.x4550.example +} diff --git a/scripts/zpool-config/x4550-raidz2-8x6.sh b/scripts/zpool-config/x4550-raidz2-8x6.sh new file mode 100644 index 000000000..45ccd7474 --- /dev/null +++ b/scripts/zpool-config/x4550-raidz2-8x6.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Sun Fire x4550 (Thumper/Thor) Raid-Z Configuration (8x6(4+2)) +# + +RANKS=8 +CHANNELS=6 + +zpool_create() { + udev_setup ${ETCDIR}/zfs/zdev.conf.x4550.example + udev_raidz2_setup ${RANKS} ${CHANNELS} + + msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZ2S[*]} + ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${RAIDZ2S[*]} || exit 1 +} + +zpool_destroy() { + msg ${ZPOOL} destroy ${ZPOOL_NAME} + ${ZPOOL} destroy ${ZPOOL_NAME} + udev_cleanup ${ETCDIR}/zfs/zdev.conf.x4550.example +} |