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

This commit is contained in:
Brian Behlendorf 2009-01-20 17:03:55 -08:00
commit cd7a847a52
3 changed files with 55 additions and 23 deletions

View File

@ -3,5 +3,5 @@ EXTRA_DIST = common.sh zfs-update.sh zfs.sh zpool-create.sh
check:
./zfs.sh -v
./zpios.sh -c lo-raid0 -t tiny -v
./zpios.sh -c file-raid0 -t tiny -v
./zfs.sh -vu

View File

@ -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
}

View File

@ -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
}