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