for disk in `fdisk -l|grep "Disk /dev"|awk '{print $2}'|sed s/://g`; do
echo "$disk" && smartctl -d ata -a "$disk" -T permissive|grep -iE 'Device Model:|Serial Number:'
echo "---------------"
done
*Make sure you have smartctl from smartmon tools installed
Sample output:
/dev/sdc
Device Model: ST3750640NS
Serial Number: 5QD3MZBP
---------------
/dev/sdb
Device Model: ST3750640NS
Serial Number: 5QD3RCTL
---------------
/dev/md0
Device Model: [No Information Found]
Serial Number: [No Information Found]
---------------
/dev/md2
Device Model: [No Information Found]
Serial Number: [No Information Found]
---------------
/dev/md1
Device Model: [No Information Found]
Serial Number: [No Information Found]
bash, disks, server, linuxfor, disk, fdisk, grep, quot, dev, awk, sed, echo, smartctl, ata, permissive, ie, smartmon, installed, output, sdc, ns, qd, mzbp, sdb, rctl, md,