X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fzpool-config%2Flo-raid0.sh;h=f24050f465318af59b18063f02abcf16ca972552;hb=1c5de20ae2511124613926e4f780572634818218;hp=321d9b1f7114b32cf0eaa806904a2ff0c77eb0c0;hpb=c9c0d073da561bcbefbdf09c87fc75b227415619;p=zfs.git diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh index 321d9b1..f24050f 100644 --- a/scripts/zpool-config/lo-raid0.sh +++ b/scripts/zpool-config/lo-raid0.sh @@ -10,6 +10,8 @@ FILES="/tmp/zpool-vdev0 \ DEVICES="" zpool_create() { + check_loop_utils + for FILE in ${FILES}; do DEVICE=`unused_loop_device` msg "Creating ${FILE} using loopback device ${DEVICE}" @@ -29,6 +31,9 @@ zpool_destroy() { msg ${ZPOOL} destroy ${ZPOOL_NAME} ${ZPOOL} destroy ${ZPOOL_NAME} + # Delay to ensure device is closed before removing loop device + sleep 1 + for FILE in ${FILES}; do DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:` msg "Removing ${FILE} using loopback device ${DEVICE}"