diff --git a/common.rc b/common.rc index b50c695f8..e00d0183c 100644 --- a/common.rc +++ b/common.rc @@ -313,9 +313,10 @@ _scratch_mkfs() zfs) # SCRATCH_DEV must be of the form 'pool/dataset' /sbin/zfs list -H $SCRATCH_DEV > /dev/null 2>&1 - if [ "$?" != "0" ]; then - /sbin/zfs create -o mountpoint=legacy $SCRATCH_DEV + if [ "$?" = "0" ]; then + /sbin/zfs destroy -f $SCRATCH_DEV fi + /sbin/zfs create -o mountpoint=legacy $SCRATCH_DEV ;; *) /sbin/mkfs -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV @@ -343,12 +344,12 @@ _scratch_mkfs_sized() /sbin/mkfs.$FSTYP $MKFS_OPTIONS $SCRATCH_DEV -b $fssize ;; zfs) - # No size required due to the nature of pooled storage # SCRATCH_DEV must be of the form 'pool/dataset' /sbin/zfs list -H $SCRATCH_DEV > /dev/null 2>&1 - if [ "$?" != "0" ]; then - /sbin/zfs create -o mountpoint=legacy $SCRATCH_DEV + if [ "$?" = "0" ]; then + /sbin/zfs destroy -f $SCRATCH_DEV fi + /sbin/zfs create -o mountpoint=legacy -o refquota=$fssize $SCRATCH_DEV ;; *) _notrun "Filesystem $FSTYP not supported in _scratch_mkfs_sized"