scan-hdd script useable

This commit is contained in:
Sandino Araico Sanchez 2016-12-12 16:34:29 -06:00
parent 80ca8d96fc
commit 63109fc217

20
scripts/scan-hdd Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
if [ -z $OUTPUT_DIR ] ; then
source scan-dmidecode
fi
DISKS=`smartctl --scan | cut -d ' ' -f 1` # | sed 's/^.*\/// ; s/$//'`
#echo $DISKS
#exit
#DISKS=sda
for DISK in ${DISKS}
do
#echo $DISK #-n "$DISK:" #>> $OUTPUT_DIR/disk.lst
echo -n "$DISK:" >> $OUTPUT_DIR/disk.lst
smartctl -i $DISK \
| grep -i 'serial number' \
| cut -d ':' -f 2 \
| sed 's/\s\+//' \
>> $OUTPUT_DIR/disk.lst
done