diff options
-rw-r--r-- | scripts/Makefile.am | 5 | ||||
-rw-r--r-- | scripts/zpool-config/file-raid0.sh | 4 | ||||
-rw-r--r-- | scripts/zpool-config/file-raid10.sh | 34 | ||||
-rw-r--r-- | scripts/zpool-config/file-raidz.sh | 31 | ||||
-rw-r--r-- | scripts/zpool-config/file-raidz2.sh | 31 |
5 files changed, 102 insertions, 3 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index ef6579bbc..5a191e99b 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -3,5 +3,8 @@ EXTRA_DIST = common.sh zfs-update.sh zfs.sh zpool-create.sh check: ./zfs.sh -v - ./zpios.sh -c file-raid0 -t tiny -v + ./zpios.sh -c file-raid0 -t tiny + ./zpios.sh -c file-raid10 -t tiny + ./zpios.sh -c file-raidz -t tiny + ./zpios.sh -c file-raidz2 -t tiny ./zfs.sh -vu diff --git a/scripts/zpool-config/file-raid0.sh b/scripts/zpool-config/file-raid0.sh index 633324821..02683fabc 100644 --- a/scripts/zpool-config/file-raid0.sh +++ b/scripts/zpool-config/file-raid0.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# 4 Device File Raid-0 Configuration +# 4 File Raid-0 Configuration # FILES="/tmp/zpool-vdev0 \ @@ -12,7 +12,7 @@ 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 || + dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null || die "Error $? creating ${FILE}" done diff --git a/scripts/zpool-config/file-raid10.sh b/scripts/zpool-config/file-raid10.sh new file mode 100644 index 000000000..d3d2d82eb --- /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=256 &>/dev/null || + die "Error $? creating ${FILE}" + done + + msg ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ + mirror ${FILES_M1} mirror ${FILES_M2} + ${CMDDIR}/zpool/zpool create ${ZPOOL_NAME} \ + mirror ${FILES_M1} mirror ${FILES_M2} || 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/file-raidz.sh b/scripts/zpool-config/file-raidz.sh new file mode 100644 index 000000000..686748907 --- /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=256 &>/dev/null || + die "Error $? creating ${FILE}" + done + + msg ${CMDDIR}/zpool/zpool create raidz ${ZPOOL_NAME} ${FILES} + ${CMDDIR}/zpool/zpool create raidz ${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/file-raidz2.sh b/scripts/zpool-config/file-raidz2.sh new file mode 100644 index 000000000..09b20e4c9 --- /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=256 &>/dev/null || + die "Error $? creating ${FILE}" + done + + msg ${CMDDIR}/zpool/zpool create raidz2 ${ZPOOL_NAME} ${FILES} + ${CMDDIR}/zpool/zpool create raidz2 ${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 +} |