diff --git a/scripts/Makefile.am b/scripts/Makefile.am index eed2ba25a0..14762a751b 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -4,5 +4,5 @@ EXTRA_DIST += zpios.sh zpios-survey.sh check: ./zfs.sh -v - ./zpios.sh -c lo-raid0 -t tiny -v + ./zpios.sh -c file-raid0 -t tiny -v ./zfs.sh -vu diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh new file mode 100644 index 0000000000..6333248213 --- /dev/null +++ b/scripts/zpool-config/file-raid0.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# 4 Device 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=256 status=noxfer &>/dev/null || + die "Error $? creating ${FILE}" + done + + msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES} + ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${FILES} || exit 1 +} + +zpool_destroy() { + msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} + + for FILE in ${FILES}; do + msg "Removing ${FILE}" + rm -f ${FILE} || exit 1 + done +} diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh index 67beac2d11..cecdf86502 100644 --- a/scripts/zpool-config/lo-raid0.sh +++ b/scripts/zpool-config/lo-raid0.sh @@ -1,38 +1,39 @@ #!/bin/bash # -# 5 Device Loopback Raid-0 Configuration +# 4 Device Loopback Raid-0 Configuration # -DEVICES="/tmp/zpool-vdev0 \ - /tmp/zpool-vdev1 \ - /tmp/zpool-vdev2 \ - /tmp/zpool-vdev3 \ - /tmp/zpool-vdev4" +FILES="/tmp/zpool-vdev0 \ + /tmp/zpool-vdev1 \ + /tmp/zpool-vdev2 \ + /tmp/zpool-vdev3" +DEVICES="" zpool_create() { - for DEV in ${DEVICES}; do - LO=`/sbin/losetup -f` - msg "Creating ${DEV} using loopback device ${LO}" - rm -f ${DEV} || exit 1 - dd if=/dev/zero of=${DEV} bs=1024k count=256 status=noxfer &>/dev/null || - die "Error $? creating ${DEV}" - losetup ${LO} ${DEV} || - die "Error $? creating ${DEV} -> ${LO} loopback" + for FILE in ${FILES}; do + DEVICE=`/sbin/losetup -f` + msg "Creating ${FILE} using loopback device ${DEVICE}" + rm -f ${FILE} || exit 1 + dd if=/dev/zero of=${FILE} bs=1024k count=256 status=noxfer &>/dev/null || + die "Error $? creating ${FILE}" + losetup ${DEVICE} ${FILE} || + die "Error $? creating ${FILE} -> ${DEVICE} loopback" + DEVICES="${DEVICES} ${DEVICE}" done - msg ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} - ${CMDDIR}/zpool/zpool create -f ${ZPOOL_NAME} ${DEVICES} || exit 1 + msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} + ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} ${DEVICES} || exit 1 } zpool_destroy() { msg ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} ${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME} - for DEV in ${DEVICES}; do - LO=`/sbin/losetup -a | grep ${DEV} | head -n1 | cut -f1 -d:` - msg "Removing ${DEV} using loopback device ${LO}" - losetup -d ${LO} || - die "Error $? destroying ${DEV} -> ${LO} loopback" - rm -f ${DEV} || exit 1 + for FILE in ${FILES}; do + DEVICE=`/sbin/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 }