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)

all infos about one’s harddisk:

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

# software needed: install smart monitoring tools
# rpm based distributions
yum install smartmontools.x86_64
# apt based distributions
apt-get install smartmontools

# nice overview: all harddisks, partitions, sizes and filesystems
lsblk -o "NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,MOUNTPOINT,UUID"
# example output:
NAME   MAJ:MIN RM   SIZE RO FSTYPE MOUNTPOINT                   UUID
sdb      8:16   0 465.8G  0                                     
└─sdb1   8:17   0 465.8G  0 ext3                                xxx
sdc      8:32   0 931.5G  0                                     
└─sdc1   8:33   0 931.5G  0 ext3   /run/media/user/SOFTWARE	xxx
sda      8:0    0 238.5G  0                                     
├─sda4   8:4    0     1K  0                                     
├─sda2   8:2    0   100G  0 ext3   /home                        xxx
├─sda5   8:5    0   7.8G  0 swap   [SWAP]                       xxx
├─sda3   8:3    0    50G  0 xfs    /                            xxx
├─sda1   8:1    0     1G  0 xfs    /boot                        xxx
└─sda6   8:6    0  79.7G  0 ext3   /run/media/user/projects	xxx

# disk usage: is it full? if yes how full is it?
# check all disks disk usage
df -h
# specific partition:
df -h /dev/sdc1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc1       917G  684G  187G  79% /run/media/user/SOFTWARE

# why is it full? (busybox qnap tested)
# list biggest 30 dir and files
du -a /run/media/user/SOFTWARE | sort -n -r | head -n 30;

# how many blocks does this partition sdc1 have?
# (use sdc to see blocks of the whole harddisk)
blockdev --report /dev/sdc1
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096       2048   1000203091968   /dev/sdc1

tune2fs -l /dev/sdc1
# example output on external usb attached wd buffalo 1tb
tune2fs 1.42.9 (28-Dec-2013)
Filesystem volume name:   SOFTWARE
Last mounted on:          /run/media/user/SOFTWARE
Filesystem UUID:          xxx
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              61054976
Block count:              244190208
Reserved block count:     12209510
Free blocks:              61059140
Free inodes:              60765281
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      965
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Filesystem created:       Tue Dec 20 23:58:16 2016
Last mount time:          Wed Jan 15 10:44:57 2020
Last write time:          Wed Jan 15 10:44:57 2020
Mount count:              55
Maximum mount count:      10
Last checked:             Tue Dec  3 17:46:21 2019
Check interval:           2592000 (1 month)
Next check after:         Thu Jan  2 17:46:21 2020
Lifetime writes:          1779 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:	          256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      582a22b3-9507-4d6c-bd9d-68ff9d707ce6
Journal backup:           inode blocks

# same same but different
dumpe2fs -h /dev/sdc1
dumpe2fs 1.42.9 (28-Dec-2013)
Filesystem volume name:   SOFTWARE
Last mounted on:          /run/media/user/SOFTWARE
Filesystem UUID:          xxx
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              61054976
Block count:              244190208
Reserved block count:     12209510
Free blocks:              61059140
Free inodes:              60765281
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      965
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Filesystem created:       Tue Dec 20 23:58:16 2016
Last mount time:          Wed Jan 15 10:44:57 2020
Last write time:          Wed Jan 15 10:44:57 2020
Mount count:              55
Maximum mount count:      10
Last checked:             Tue Dec  3 17:46:21 2019
Check interval:           2592000 (1 month)
Next check after:         Thu Jan  2 17:46:21 2020
Lifetime writes:          1779 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:	          256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      582a22b3-9507-4d6c-bd9d-68ff9d707ce6
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
Journal size:             128M
Journal length:           32768
Journal sequence:         0x0001bda3
Journal start:            1

# run filesystem check on this partition
# write harddisk cache to disk
sync;
# unmount all partitions of sdc
umount /dev/sdc*;
fsck -v -y -f /dev/sdc1

enough with the filesystem stuff, give some detail about the hardware:

# get hardware informations about all kind of storage devices
apt install lshw; # apt based systems
yum install lshw; # rpm based systems
lshw -class tape -class disk -class storage -short
H/W path               Device     Class          Description
============================================================
/0/100/14/1/2          scsi3      storage        External USB 3.0
/0/100/14/1/2/0.0.0    /dev/sdb   disk           500GB External USB 3.0
/0/100/1f.2                       storage        8 Series SATA Controller 1 [AHCI mode]
/0/2                   scsi0      storage        
/0/2/0.0.0             /dev/sda   disk           250GB Samsung SSD 860

# get hardware informations about sata attached disks
# (usually does not work for usb harddisks)
hdparm -i /dev/sda

/dev/sda:

Model=SanDisk SDSSDHP256G, FwRev=X2316RL, SerialNo=XXXXX
Config={ Fixed }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
BuffType=unknown, BuffSize=unknown, MaxMultSect=1, MultSect=1
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=500118192
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6
AdvancedPM=yes: unknown setting WriteCache=enabled
Drive conforms to: unknown: ATA/ATAPI-4,5,6,7

* signifies the current active mode

hdparm -i /dev/sdb

/dev/sdb:
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 HDIO_GET_IDENTITY failed: Invalid argument

# had problems with Crucial SSD 64GB... interesting output smartctl
smartctl -i /dev/sdb
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 INFORMATION SECTION ===
Model Family:     Crucial/Micron RealSSD m4/C400
Device Model:     M4-CT064M4SSD2
LU WWN Device Id: 5 00a075 109090487
Firmware Version: 000F
User Capacity:    64,023,257,088 bytes [64.0 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ATA8-ACS T13/1699-D revision 6
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 1.5 Gb/s)
Local Time is:    Mon Jan 27 15:19:47 2020 CET

==> WARNING: This drive may hang after 5184 hours of power-on time:
http://www.tomshardware.com/news/Crucial-m4-Firmware-BSOD,14544.html
See the following web pages for firmware updates:
http://www.crucial.com/support/firmware.aspx
http://www.micron.com/products/solid-state-storage/client-ssd#software

SMART support is: Available - device has SMART capability.
SMART support is: Enabled
# "Makes you wonder if there is a hidden agenda behind the 'counter'.
# IF counter>5000 AND warranty=-1 THEN FAIL" ;)

# one fine day the x60s... just did not boot up anymore... and hung at boot...
# even when correct decryption password was given
# even when smartctl -H says "PASSED"
# when booting from USB stick it hangs 
# there is something off with this device, it goes to trash
# this is the first SSD to fail ...
# smartctl still manages to get hardware details about the usb attached harddisk
smartctl -i /dev/sdc
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 INFORMATION SECTION ===
Model Family:     Western Digital Caviar Green
Device Model:     WDC WD10EACS-00ZJB0
Serial Number:    WD-xxx
LU WWN Device Id: 5 0014ee 201410d3d
Firmware Version: 01.01B01
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:   ATA8-ACS (minor revision not indicated)
SATA Version is:  SATA 2.5, 3.0 Gb/s
Local Time is:    Wed Jan 15 16:57:24 2020 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

# read "S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology" telemetry from drive
smartctl -H /dev/sdc
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

if someone is interested… this is the full SMART data of the Crucial SSD:

smartctl -a /dev/sdb
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 INFORMATION SECTION ===
Model Family:     Crucial/Micron RealSSD m4/C400
Device Model:     M4-CT064M4SSD2
Serial Number:    00000000121709090487
LU WWN Device Id: 5 00a075 109090487
Firmware Version: 000F
User Capacity:    64,023,257,088 bytes [64.0 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ATA8-ACS T13/1699-D revision 6
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 1.5 Gb/s)
Local Time is:    Mon Jan 27 15:52:09 2020 CET

==> WARNING: This drive may hang after 5184 hours of power-on time:
http://www.tomshardware.com/news/Crucial-m4-Firmware-BSOD,14544.html
See the following web pages for firmware updates:
http://www.crucial.com/support/firmware.aspx
http://www.micron.com/products/solid-state-storage/client-ssd#software

SMART support is: Available - device has SMART capability.
SMART support is: Enabled

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

General SMART Values:
Offline data collection status:  (0x80)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0)	The previous self-test routine completed
					without error or no self-test has ever 
					been run.
Total time to complete Offline 
data collection: 		(  295) seconds.
Offline data collection
capabilities: 			 (0x7b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					Conveyance Self-test supported.
					Selective Self-test supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x01)	Error logging supported.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   2) minutes.
Extended self-test routine
recommended polling time: 	 (   4) minutes.
Conveyance self-test routine
recommended polling time: 	 (   3) minutes.
SCT capabilities: 	       (0x003d)	SCT Status supported.
					SCT Error Recovery Control supported.
					SCT Feature Control supported.
					SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   100   100   050    Pre-fail  Always       -       0
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   100   100   001    Old_age   Always       -       39651
(4.5 years... used was used in a server... then in a lenovo x60s... then it failed)

 12 Power_Cycle_Count       0x0032   100   100   001    Old_age   Always       -       214
170 Grown_Failing_Block_Ct  0x0033   100   100   010    Pre-fail  Always       -       0
171 Program_Fail_Count      0x0032   100   100   001    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   100   100   001    Old_age   Always       -       0
173 Wear_Leveling_Count     0x0033   097   097   010    Pre-fail  Always       -       99
174 Unexpect_Power_Loss_Ct  0x0032   100   100   001    Old_age   Always       -       70
181 Non4k_Aligned_Access    0x0022   100   100   001    Old_age   Always       -       652 510 142
183 SATA_Iface_Downshift    0x0032   100   100   001    Old_age   Always       -       0
184 End-to-End_Error        0x0033   100   100   050    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   001    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   001    Old_age   Always       -       0
189 Factory_Bad_Block_Ct    0x000e   100   100   001    Old_age   Always       -       77
194 Temperature_Celsius     0x0022   100   100   000    Old_age   Always       -       0
195 Hardware_ECC_Recovered  0x003a   100   100   001    Old_age   Always       -       0
196 Reallocated_Event_Count 0x0032   100   100   001    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   100   100   001    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   100   001    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   100   100   001    Old_age   Always       -       0
202 Perc_Rated_Life_Used    0x0018   097   097   001    Old_age   Offline      -       3
206 Write_Error_Rate        0x000e   100   100   001    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

related links:

GNU Linux bash – how to get nice overview over harddisks and patitions

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