#!/bin/ksh93 # License: CDDL 1.0 # Copyright (C) 2012 , Jens Elkner. Usage() { BN=`basename $0` printf 'Usage: %s [-h] guid List the ZFS treed an mark the device wth the given hex guid with a "===>". Options: -h .. print this help and exit guid .. vdev number (guid as hex) as shown in "fmdump -v" Example: %s c48108557eb8fd2c ' "$BN" "$BN" } while getopts "h:(help)" option ; do case "$option" in h) Usage ; exit 0 ;; esac done IDX=$(($OPTIND-1)) shift $IDX VDEV="$1" [[ -z "$VDEV" ]] && Usage && exit 1 typeset -u HEX=$VDEV GUID=`echo "16i $HEX p" | dc` zdb | sed -e "/guid=$GUID/ s,^ ,===>,"