#!/usr/bin/ksh # Utility to read the PVID from a disk header. if [ "${1}" = "" ] then echo "ERROR: Unable to determine disk. Exiting." exit fi if [ ! -b ${1} ] then echo "ERROR: This does not look like a proper device. Exiting." exit fi # The following code could be done in a one-liner... But the point of this # code is half utility, half instructive... and putting it all on one line # would ruin half the experience. # Read the PVID into a temp file dd if=${1} of=/tmp/pvidblock bs=1 count=8 skip=128 > /dev/null 2>&1 #od -x /tmp/pvidblock # dump get first line take off line # remove all spaces od -x /tmp/pvidblock | grep "^0000000" | sed -e "s/^0* //" | tr -d [:space:] # throw in a carriage return echo # Remove the temp file rm -f /tmp/pvidblock