Commit 525eb7e9 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add print_disks.sh

parent 63870f26
#!/bin/sh
VERBOSE=
[ "$1" = "-v" ] && VERBOSE=1
. $(dirname $0)/print_disks.physorder.sh
#case "$(hostname -s)" in
# clients)
# PHYSORDER="4Q2H 6866 2690 2486 2471 0052 8696 4552 8520"
# ;;
# *)
# echo "Unknown hostname $(hostname -s)"
# exit 1
#esac
echo >$0.log
for i in /dev/sd? ; do
[ -n "$VERBOSE" ] && echo
[ -n "$VERBOSE" ] && hdparm -i $i | grep -B2 SerialNo | grep -v "^$"
SERNO=$(hdparm -i $i | grep SerialNo | sed -e "s/.*SerialNo=//g" | tail -c 5)
[ -n "$VERBOSE" ] && blkid ${i}1
LABEL=$(blkid -s LABEL ${i}1 | sed -e 's/.*LABEL="\(.*\)"/\1/')
printf "%s %6s %s\n" "$i" "$LABEL" "$SERNO" | tee -a $0.log
done
echo >$0.log.found
echo
echo "In physical order:"
for i in $PHYSORDER ; do
if grep " $i$" $0.log ; then
grep " $i$" $0.log >> $0.log.found
else
echo "$i is MISSED"
fi
done
echo
echo "Differences:"
sort <$0.log >$0.log.sort
sort <$0.log.found >$0.log.found.sort
diff -u $0.log.sort $0.log.found.sort
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment