#!/bin/sh ## http://kobyla.info/soft/dumplabel ## $Id: dumplabel,v 1.8 2013/09/02 11:06:38 pdc Exp $ CNT=1 cd /dev help= nl=" " VN=$1 { [ -z "$VN" ] && help="$help "; } || { [ ! -r "$VN" ] && help="$help${nl}Unable to read vnode: $VN" ;} if [ -n "$2" ]; then [ "$2" -gt 0 ] 2>/dev/null && CNT=$2 || help="$help${nl}Invalid sector count: $2" fi [ -z "$help" ] && { DI=`diskinfo $VN` || help="$help${nl}Not a disk? $VN" ;} if [ -n "$help" ]; then echo "Usage: $0 [ [hd options]]$help" { [ "$help" = " " ] && exit; } || exit 65 fi LAST=`echo "$DI" | awk "{print \\$4-$CNT}"` echo "VN=$VN CNT=$CNT LAST=$LAST // $DI" > /dev/stderr dd if=$VN skip=$LAST count=$CNT | (sleep 0.2;hd $3 ) | tr '\176-\377' 'Û'