How To Find Out Hard Disk Specs / Details on Linux

How To Find Out Hard Disk Specs / Details on Linux

Can you tell me a Linux command to find out information about my hard disk such as description, product name, bus type, size, and cache memory size under Linux operating systems using command line options?

Linux comes with various commands to find out information about your hard drive. I recommend hdparm command, which provides a command-line interface to various hard disk ioctls supported by the stock Linux ATA/IDE device driver subsystem. This command reads/request identification information such as disk size, description, and much more directly from the drive, which is displayed in a new expanded format. Let us see various Linux disk info commands to print hard disk drive details on screen.

Use the hdparm command to find hard disk drive specification on Linux

Open the terminal and type the following command to find information about /dev/sda:

hdparm -I /dev/sda
# OR
sudo hdparm -I /dev/sda

Here is what I see:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/dev/sda:

ATA device, with non-removable media
        Model Number:       ST3500630AS                             
        Serial Number:      9XXYZ845YZ
        Firmware Revision:  3.AAK   
Standards:
        Supported: 7 6 5 4 
        Likely used: 7
Configuration:
        Logical         max     current
        cylinders       16383   16383
        heads           16      16
        sectors/track   63      63
        --
        CHS current addressable sectors:   16514064
        LBA    user addressable sectors:  268435455
        LBA48  user addressable sectors:  976773168
        device size with M = 1024*1024:      476940 MBytes
        device size with M = 1000*1000:      500107 MBytes (500 GB)
Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, no device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 16
        Recommended acoustic management value: 254, current value: 0
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4 
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    Host Protected Area feature set
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    DOWNLOAD_MICROCODE
                SET_MAX security extension
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    SATA-I signaling speed (1.5Gb/s)
           *    SATA-II signaling speed (3.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Phy event counters
                Device-initiated interface power management
           *    Software settings preservation
Security: 
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
                frozen
        not     expired: security count
        not     supported: enhanced erase
Checksum: correct

lshw command

You need to install lshw command using apt-get or yum command. To display all disks and storage controllers in the system, enter:

lshw -class disk -class storage

From my Linux machine:

  *-storage               
       description: Mass storage controller
       product: 5-in-1 Multimedia Card Reader (SD/MMC/MS/MS PRO/xD)
       vendor: Texas Instruments
       physical id: 1.2
       bus info: pci@0000:03:01.2
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: storage pm bus_master cap_list
       configuration: driver=tifm_7xx1 latency=64 maxlatency=4 mingnt=7
       resources: irq:19 memory:f19fa000-f19fafff
  *-storage
       description: SATA controller
       product: 5 Series/3400 Series Chipset 6 port SATA AHCI Controller
       vendor: Intel Corporation
       physical id: 1f.2
       bus info: pci@0000:00:1f.2
       logical name: scsi0
       logical name: scsi1
       logical name: scsi2
       version: 05
       width: 32 bits
       clock: 66MHz
       capabilities: storage msi pm ahci_1.0 bus_master cap_list emulated
       configuration: driver=ahci latency=0
       resources: irq:32 ioport:6e70(size=8) ioport:6e78(size=4) ioport:6e80(size=8) ioport:6e88(size=4) ioport:6ea0(size=32) memory:fed1e000-fed1e7ff
     *-disk:0
          description: ATA Disk
          product: TOSHIBA MK5061GS
          vendor: Toshiba
          physical id: 0
          bus info: scsi@0:0.0.0
          logical name: /dev/sda
          version: MF00
          serial: 71XYZYYYY
          size: 465GiB (500GB)
          capabilities: partitioned partitioned:dos
          configuration: ansiversion=5 signature=00025d42
     *-cdrom
          description: DVD-RAM writer
          product: BD-RE UJ232A
          vendor: MATSHITA
          physical id: 1
          bus info: scsi@1:0.0.0
          logical name: /dev/cdrom
          logical name: /dev/cdrw
          logical name: /dev/dvd
          logical name: /dev/dvdrw
          logical name: /dev/scd0
          logical name: /dev/sr0
          logical name: /media/cdrom0
          version: 1.10
          capabilities: removable audio cd-r cd-rw dvd dvd-r dvd-ram
          configuration: ansiversion=5 mount.fstype=udf mount.options=ro,nosuid,nodev,noexec,relatime,utf8 state=mounted status=ready
        *-medium
             physical id: 0
             logical name: /dev/cdrom
             logical name: /media/cdrom0
             configuration: mount.fstype=udf mount.options=ro,nosuid,nodev,noexec,relatime,utf8 state=mounted
     *-disk:1
          description: ATA Disk
          product: ST9500420ASG
          vendor: Seagate
          physical id: 0.0.0
          bus info: scsi@2:0.0.0
          logical name: /dev/sdb
          version: 0004
          serial: 5VXYZYYYY
          size: 465GiB (500GB)
          capabilities: gpt-1.00 partitioned partitioned:gpt
          configuration: ansiversion=5 guid=8795c9fc-5238-11e1-84e2-00216aca9b10

Finding Out Linux Disks Names Only

The following lshw command will quickly list installed disks including CD/DVD/BD drivers:

lshw -short -C disk

Sample outputs:

H/W path             Device      Class       Description
========================================================
/0/100/1f.2/0        /dev/sda    disk        500GB TOSHIBA MK5061GS
/0/100/1f.2/1        /dev/cdrom  disk        BD-RE UJ232A
/0/100/1f.2/1/0      /dev/cdrom  disk        
/0/100/1f.2/0.0.0    /dev/sdb    disk        500GB ST9500420ASG

Another option so to run the fdisk command as follows:

fdisk -l

Using lsblk command to find out Linux hard disk information

Run the **lsblk88 command as follows to lists information about all available or the specified block devices:

lsblk
lsblk /dev/DISK
lsblk /dev/sda

So I have two NVMe SSD in RAID-1 mode with encrypted partitions:

nvme0n1               259:0    0 953.9G  0 disk  
├─nvme0n1p1           259:1    0   953M  0 part  /boot/efi
├─nvme0n1p2           259:2    0   3.7G  0 part  
│ └─md0                 9:0    0   3.7G  0 raid1 /boot
└─nvme0n1p3           259:3    0 949.2G  0 part  
  └─md1                 9:1    0 949.1G  0 raid1 
    └─md1_crypt       253:0    0 949.1G  0 crypt 
      ├─nixcraft-swap 253:1    0 119.2G  0 lvm   [SWAP]
      └─nixcraft-root 253:2    0 829.9G  0 lvm   /
nvme1n1               259:4    0 953.9G  0 disk  
├─nvme1n1p1           259:5    0   953M  0 part  
├─nvme1n1p2           259:6    0   3.7G  0 part  
│ └─md0                 9:0    0   3.7G  0 raid1 /boot
└─nvme1n1p3           259:7    0 949.2G  0 part  
  └─md1                 9:1    0 949.1G  0 raid1 
    └─md1_crypt       253:0    0 949.1G  0 crypt 
      ├─nixcraft-swap 253:1    0 119.2G  0 lvm   [SWAP]
      └─nixcraft-root 253:2    0 829.9G  0 lvm   /

Another option is to run the following ls command to list all disks and their names:

ls -lF /dev/disk/by-id/

Linux show block device such as hard disk drive attributes

Open the terminal app and then type the blkid command:

blkid
/dev/sda1: UUID="35D0-69B0" TYPE="vfat" PARTUUID="50f81f2e-9c4c-43ce-896d-7a55bee67397"
/dev/sda2: UUID="985b0131-765b-4d1e-94fa-8c86491dad4d" TYPE="ext4" PARTUUID="00

smartctl command

The smartctl command act as a control and monitor Utility for SMART disks under Linux and Unix like operating systems. Type the following command to get information about /dev/sda (SATA disk):

smartctl -d ata -a -i /dev/sda

From my laptop:

smartctl 5.40 2010-07-12 r3124 [x86_64-unknown-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Device Model:     TOSHIBA MK5061GSYF
Serial Number:    71XXXYYZ
Firmware Version: MF000D
User Capacity:    500,107,862,016 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   8
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Fri Feb 24 05:27:29 2012 IST
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:  (0x00)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Disabled.
Self-test execution status:      (  36)	The self-test routine was interrupted
					by the host with a hard or soft reset.
Total time to complete Offline 
data collection: 		 ( 120) seconds.
Offline data collection
capabilities: 			 (0x5b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					No 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: 	 ( 136) 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: 128
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000b   100   100   050    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   100   100   001    Pre-fail  Always       -       1650
  5 Reallocated_Sector_Ct   0x0033   100   100   050    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   099   099   000    Old_age   Always       -       34237
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       120
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       42
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       23
193 Load_Cycle_Count        0x0032   099   099   000    Old_age   Always       -       13971
194 Temperature_Celsius     0x0022   100   100   000    Old_age   Always       -       39 (Lifetime Min/Max 21/48)
199 UDMA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       3536073
200 Multi_Zone_Error_Rate   0x0032   100   100   000    Old_age   Always       -       9143982
240 Head_Flying_Hours       0x0032   099   099   000    Old_age   Always       -       28415
241 Total_LBAs_Written      0x0032   100   100   000    Old_age   Always       -       741418060
242 Total_LBAs_Read         0x0032   100   100   000    Old_age   Always       -       450708673
254 Free_Fall_Sensor        0x0032   100   100   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Interrupted (host reset)      40%       343         -
# 2  Short offline       Completed without error       00%       186         -
# 3  Short offline       Completed without error       00%        71         -
# 4  Short offline       Completed without error       00%         0         -
# 5  Short offline       Completed without error       00%         0         -

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.

SUBSCRIBE FOR NEW ARTICLES

@
comments powered by Disqus