hw-test/scripts/scan-hdd

26 lines
564 B
Text
Raw Normal View History

2016-12-12 16:34:29 -06:00
#!/bin/bash
2016-12-14 22:57:46 -06:00
if [[ -z $OUTPUT_DIR ]] ; then
2016-12-12 16:34:29 -06:00
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\+//' `
2016-12-14 22:57:46 -06:00
if [[ ! -z $SERIAL ]] ; then
echo "$DISK:$SERIAL"
echo "$DISK:$SERIAL" \
>> $OUTPUT_DIR/disk.lst
mkdir -p $OUTPUT_DIR/disk
2016-12-15 22:08:43 -06:00
smartctl --all /dev/$DISK > $OUTPUT_DIR/disk/$SERIAL.smart-all
ln -sf $OUTPUT_DIR/disk/$SERIAL.smart-all \
$OUTPUT_DIR/disk/$DISK.smart-all
fi
2016-12-12 16:34:29 -06:00
done
2016-12-12 16:35:27 -06:00