diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh index 2adaf8fac..b20eee672 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_004_pos.ksh @@ -40,12 +40,12 @@ function cleanup for DISK in $DISKS; do zpool labelclear -f $DEV_RDSKDIR/$DISK done - if is_freebsd ; then + if is_freebsd; then log_must sysctl kern.geom.debugflags=$saved_debugflags fi } -if is_freebsd ; then +if is_freebsd; then # FreeBSD won't allow writing to an in-use device without this set saved_debugflags=$(sysctl -n kern.geom.debugflags) log_must sysctl kern.geom.debugflags=16 @@ -54,32 +54,21 @@ fi verify_runnable "global" verify_disk_count "$DISKS" 2 set -A DISK $DISKS -if is_freebsd ; then - WHOLE_DISK=/dev/${DISK[0]} -else - WHOLE_DISK=${DISK[0]} -fi default_mirror_setup_noexit $DISKS DEVS=$(get_pool_devices ${TESTPOOL} ${DEV_RDSKDIR}) [[ -n $DEVS ]] && set -A DISK $DEVS -log_must zpool offline $TESTPOOL ${WHOLE_DISK} +log_must zpool offline $TESTPOOL ${DISK[0]} log_must dd if=/dev/urandom of=$TESTDIR/testfile bs=1K count=2 log_must zpool export $TESTPOOL log_must dd if=$DEV_RDSKDIR/${DISK[0]} of=$DEV_RDSKDIR/${DISK[1]} bs=1K count=256 conv=notrunc -if is_freebsd; then - DISK1="/dev/${DISK[1]}" -else - DISK1="${DISK[1]}" -fi - -ubs=$(zdb -lu ${DISK1} | grep -e LABEL -e Uberblock -e 'labels = ') +ubs=$(zdb -lu ${DISK[1]} | grep -e LABEL -e Uberblock -e 'labels = ') log_note "vdev 1: ubs $ubs" -ub_dump_counts=$(zdb -lu ${DISK1} | \ +ub_dump_counts=$(zdb -lu ${DISK[1]} | \ awk ' /LABEL/ {label=$NF; blocks[label]=0}; /Uberblock/ {blocks[label]++}; END {print blocks[0],blocks[1],blocks[2],blocks[3]}')