From 63109fc217d24a25091fefb8a29c5229a3abfb43 Mon Sep 17 00:00:00 2001 From: Sandino Araico Sanchez Date: Mon, 12 Dec 2016 16:34:29 -0600 Subject: [PATCH] scan-hdd script useable --- scripts/scan-hdd | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 scripts/scan-hdd diff --git a/scripts/scan-hdd b/scripts/scan-hdd new file mode 100755 index 0000000..a0c287f --- /dev/null +++ b/scripts/scan-hdd @@ -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