… because maybe one wants to read their smart status.

# tested on:
hostnamectl 
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 5.X
      Architecture: x86-64

# and also:
hostnamectl
   Static hostname: storagepc
  Operating System: Debian GNU/Linux 9 (stretch)
            Kernel: Linux 4.9.0-11-amd64
      Architecture: x86-64
vim /scripts/harddisk_iteration.sh
# fill with:

#!/bin/bash

echo "=== iterate over all harddisks in the system: ==="
for x in {a..z}
do
if test $(ls /dev |grep sd$x |wc -l) != 0; then
	echo "------------------- /dev/sd$sd$x --------------------";
	/usr/sbin/smartctl -H /dev/sd$sd$x;
	/usr/sbin/smartctl -i /dev/sd$sd$x;
fi
done

echo "=== print nice overview over all harddisks and filesystems: ==="
lsblk -o "NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,MOUNTPOINT,UUID"

warning!

just because „smart“ says „passed“ (everything okay) does not mean, the harddisk will fail, a few hours or a day after that „passed“ message. (predictions based on smart are hard to do… but as soon as smart goes bad, one should swap harddisks immediately… or have spare RAID harddisks already preinstalled (would be best).

also important: simulate raid failure… what will happen if one pulls out one of two harddisks of RAID1?

how long is the rebuild time (multiple hours for 2TB and probably 2-3 Days for 4TB SATA drives).

example output:

(imho most external USB harddisks smart status can not be read)

=== iterate over all harddisks in the system: ===
------------------- /dev/sda --------------------
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-11-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-11-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     LITEONIT LCS-256M6S 2.5 7mm 256GB
Serial Number:    ...
Firmware Version: DC8110D
User Capacity:    256,060,514,304 bytes [256 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS, ATA/ATAPI-7 T13/1532D revision 4a
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat Jan  4 16:14:11 2020 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

------------------- /dev/sdb --------------------
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-11-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-11-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     SAMSUNG SpinPoint F2 EG
Device Model:     SAMSUNG HD103SI
Serial Number:    ...
LU WWN Device Id: 5 0024e9 00139b5d7
Firmware Version: 1AG01113
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA/ATAPI-7, ATA8-ACS T13/1699-D revision 3b
Local Time is:    Sat Jan  4 16:14:11 2020 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

------------------- /dev/sdc --------------------
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-11-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-11-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Constellation ES.3
Device Model:     ST2000NM0033-9ZM175
Serial Number:    ...
LU WWN Device Id: 5 000c50 07a708a36
Firmware Version: SN04
User Capacity:    2,000,398,934,016 bytes [2.00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2 (minor revision not indicated)
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat Jan  4 16:14:11 2020 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

....

more compact output:

just drive letter, smart status and device model

#!/bin/bash

echo "=== iterate over all harddisks in the system: ==="
for x in {a..z}
do
if test $(ls /dev |grep sd$x |wc -l) != 0; then
	echo "------------------- /dev/sd$sd$x --------------------";
	/usr/sbin/smartctl -H /dev/sd$sd$x;
	/usr/sbin/smartctl -i /dev/sd$sd$x | grep Model;
	echo "";
fi
done
admin