hw-test/scripts/scan-hdd

24 lines
470 B
Text
Raw Normal View History

2016-12-12 16:34:29 -06:00
#!/bin/bash
if [ -z $OUTPUT_DIR ] ; then
source scan-dmidecode
fi
echo "#DEV:SERIAL" > $OUTPUT_DIR/disk.lst
for BLKDEV in /sys/block/sd*
2016-12-12 16:34:29 -06:00
do
DISK=`basename $BLKDEV`
SERIAL=`smartctl -i /dev/$DISK \
2016-12-12 18:41:53 -06:00
| grep -i 'serial number' \
| cut -d ':' -f 2 \
| sed 's/\s\+//' `
if [ ! -z $SERIAL ] ; then
echo "$DISK:$SERIAL"
echo "$DISK:$SERIAL" \
>> $OUTPUT_DIR/disk.lst
mkdir -p $OUTPUT_DIR/disk
smartctl --all > $OUTPUT_DIR/disk/$SERIAL.smartctl-all
fi
2016-12-12 16:34:29 -06:00
done
2016-12-12 16:35:27 -06:00