for good overview it makes sense to label the harddisk partitions according to functionality (what is their purpose?)

GNU Linux bash – how to label partitions tune2fs (xfs & ext4)

# where is what & updates over changes (usb disk attached?) in realtime:

# define alias
alias loop_df='while true; do (clear; hostnamectl; echo '\''=========== looped harddisk info '\''; datum; dmesg|tail -n20; echo '\''=========== where is what'\''; harddisks; echo '\''=========== harddisk usage'\''; df -Th;) ; sleep 1 ; done'

# run it
loop_df

# looks like

lsblk -o "NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,MOUNTPOINT,UUID"
NAME                                          MAJ:MIN RM   SIZE RO FSTYPE      MOUNTPOINT UUID
sda                                             8:0    0 838.3G  0                        
├─sda2                                          8:2    0 837.3G  0 crypto_LUKS            23c92dca-43f2-4a55-80cf-acfecb0ca482
│ └─luks-23c92dca-43f2-4a55-80cf-acfecb0ca482 253:0    0 837.3G  0 LVM2_member            aXsFmd-a5wn-tP5p-AM2k-Jmx3-Sdhn-0vT911
│   ├─centos-root                             253:1    0    50G  0 xfs         /          6753e6ae-b9e7-4a77-80ca-de39bd484771
│   ├─centos-swap                             253:2    0   7.9G  0 swap        [SWAP]     00f4de69-bda9-4a6e-92b6-30b6c310a0f8
│   └─centos-home                             253:3    0 779.4G  0 xfs         /home      57da2226-1ccb-4afc-8d2c-484aac945d1f
└─sda1                                          8:1    0     1G  0 xfs         /boot      4e5482bc-c27b-4254-843a-a3c6eb7d697e

# disk space free/used?
df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 7.8G     0  7.8G   0% /dev
tmpfs                    7.9G     0  7.9G   0% /dev/shm
tmpfs                    7.9G  9.2M  7.9G   1% /run
tmpfs                    7.9G     0  7.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root   50G   23G   28G  45% /
/dev/sda1               1014M  280M  735M  28% /boot
/dev/mapper/centos-home  780G   33M  780G   1% /home
tmpfs                    1.6G     0  1.6G   0% /run/user/1000

# what sata/raid controllers are there? (try it, does not work anymore in Debian 11)
cat /proc/scsi/scsi 
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: HP       Model: P410i            Rev: 6.60
  Type:   RAID                             ANSI  SCSI revision: 05
Host: scsi0 Channel: 01 Id: 00 Lun: 00
  Vendor: HP       Model: LOGICAL VOLUME   Rev: 6.60
  Type:   Direct-Access                    ANSI  SCSI revision: 05

# iterate over all harddisks
# show exact harddisk model & firmware version & serial
# (works with sata drives but not with hardware raid adapters or (most) usb-attached (external) disks (try!))
hdparm -I /dev/sd[a-d]|grep Model -A3
        Model Number:       Hitachi HUS724040ALE641                 
        Serial Number:      XXXXXXXX            
        Firmware Revision:  MJAOA5F0
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8-AST T13 Project D1697 Revision 0b
--
        Model Number:       Hitachi HUS724040ALE641                 
        Serial Number:      XXXXXXXX            
        Firmware Revision:  MJAOA5F0
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8-AST T13 Project D1697 Revision 0b
--
        Model Number:       Hitachi HUS724040ALE641                 
        Serial Number:      XXXXXXXX            
        Firmware Revision:  MJAOA5F0
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8-AST T13 Project D1697 Revision 0b
--
        Model Number:       Hitachi HUS724040ALE641                 
        Serial Number:      XXXXXXXX            
        Firmware Revision:  MJAOA5F0
        Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0; Revision: ATA8-AST T13 Project D1697 Revision 0b
--
        Model Number:       LITEONIT LCS-256M6S 2.5 7mm 256GB       
        Serial Number:      XXXXXXXX
        Firmware Revision:  DC8110D 
        Transport:          Serial, ATA8-AST, SATA II Extensions, SATA Rev 2.6, SATA Rev 3.0


# smart status health
smartctl -H /dev/sda

smartctl 6.5 2016-05-07 r4318 [x86_64-linux-4.15.9] (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


# get temp of hd
smartctl -A /dev/sda | grep -i temperature
194 Temperature_Celsius     0x0022   045   072   ---    Old_age   Always       -       55 (Min/Max 12/72)

 

related links:

https://dwaves.de/2019/09/08/linux-bash-script-iterate-over-all-harddisks-in-the-system-and-check-their-smart-status-also-for-qnap-nas/

https://dwaves.de/2020/11/13/gnu-linux-basic-harddisks-benchmarks-ssds-kingston-skc600512g-vs-samsung-ssd-850-pro-vs-samsung-ssd-860-evo-ntfs-vs-ext4-how-fast-are-virtual-harddisks/

GNU Linux Bash – show iterate over partitions harddisk models namens types and UUIDs

https://dwaves.de/2019/09/08/linux-bash-script-iterate-over-all-harddisks-in-the-system-and-check-their-smart-status-also-for-qnap-nas/

 

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin