Home Linux Tips & Tricks How To Find Hard Disk Drive Details In Linux

How To Find Hard Disk Drive Details In Linux

Different Ways To Display Hard Disk Drive Details in Linux

By sk
Published: Last Updated on 66.2K views

This guide lists various methods to find Hard disk drive details in Linux operating systems. Using the below methods, you can able to find the hard disk make, hard disk type, size, firmware version, partition tables and other hardware parameters.

First, we will see how to display hard disk details with hdparm command line utility.

1. Hdparm

Hdparm is a command line program to get or set hardware parameters for PATA, SATA, SAS and SSD devices.

It accepts any device as mass storage that is connected to IDE, SATA, SAS interfaces, so we can even retrieve information about CD/DVD drives as well.

Using hdparm utility, we can tune the hard disk or DVD drive, test the HDD or SSD speed, reduce noise level by activating acoustic mode, turn energy-saving mode on or off, enable or disable sleep mode, enable/disable drive cache and even erase drives securely.

Hdparm is written by Mark Lord, the lead developer and maintainer of the (E)IDE driver for Linux, and current contributor to the "libata" subsystem.

A word of caution

Even though hdparm offers significant advantages to increase disk performance, it is also EXTREMELY DANGEROUS. It will very likely lead to massive data loss when some parameters are misused. The hdparm documentation suggests that YOU SHOULD NOT USE SOME COMMANDS AT ANY CIRCUMSTANCES. So I've excluded such dangerous commands in this guide. More importantly, It is always recommended to backup your hard drive before testing hdparm on your Linux system.

1.1. Install hdparm on Linux

Hdparm comes pre-installed in most Linux distributions. If it is not included for any reason, install hdparm on your Linux system using the default package manager.

On Arch Linux, Manjaro Linux:

$ sudo pacman -S hdparm

On Debian, Ubuntu, Linux Mint:

$ sudo apt install hdparm

On Fedora, CentOS, RHEL:

$ sudo dnf install hdparm

On openSUSE:

$ sudo zypper install hdparm

1.2. Find Hard Disk Drive details in Linux using Hdparm

To display detailed information of the hard disk, simply run hdparm with sudo or root privileges as shown below:

$ sudo hdparm -I /dev/sda | less

Here, sda is my hard disk. Replace it with your own device. Here I have used "less" command for interactive reading. Press ENTER key or hit UP/DOWN arrows to go through the rest of the output. Press q to exit when done.

Sample output from my Ubuntu system:

/dev/sda:

ATA device, with non-removable media
        Model Number:       ST9500325AS                             
        Serial Number:      5VEQTRV0
        Firmware Revision:  D005DEM1
        Transport:          Serial
Standards:
        Used: unknown (minor revision code 0x0029) 
        Supported: 8 7 6 5 
        Likely used: 8
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
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:      476940 MBytes
        device size with M = 1000*1000:      500107 MBytes (500 GB)
        cache/buffer size  = 8192 KBytes
        Nominal Media Rotation Rate: 5400
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
        Advanced power management level: 254
        Recommended acoustic management value: 208, current value: 208
        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
[...]
Display Hard Disk Details With Hdparm Command In Linux

Display Hard Disk Details With Hdparm Command In Linux

As you can see, the hdparm displays the hard disk's model number, serial number, firmware revision followed by hard disk configuration (no of cylinders, heads, sectors), DMA settings, list of enabled features, security parameters etc. All functions found under "Commands/features" section and marked with an asterisk are currently active.

Similarly, you can check information of other devices.

$ sudo hdparm -I /dev/sdb | less
$ sudo hdparm -I /dev/sdc | less

When running hdparm with no options, -acdgkmur is assumed. Refer man pages to know what each option is for.

$ sudo hdparm /dev/sda
/dev/sda:
 multcount     = 16 (on)
 IO_support    =  1 (32-bit)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 60801/255/63, sectors = 976773168, start = 0

For more details, refer man pages.

$ man hdparm

2. lshw

Lshw (Hardware Lister) is a simple, yet full-featured utility that provides detailed information on the hardware configuration of a Linux system. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, Hard disk drive details, cache configuration, bus speed and a lot more.

2.1. Install lshw in Linux

lshw comes pre-installed with some Linux distributions like Ubuntu by default. If it is not installed by any chance, install lshw in your Linux box using the default package manager like below.

On Arch Linux and its variants like Manjaro Linux, run:

$ sudo pacman -S lshw

On Debian, Ubuntu, Linux Mint:

$ sudo apt install lshw

On Fedora, CentOS, RHEL:

$ sudo dnf install lshw

On openSUSE:

$ sudo zypper install lshw

2.2. View Hard Disk Drive Details In Linux Using lshw

After installing lshw, simply run the following command to get the details of your hard disk drive in Linux:

$ sudo lshw -class disk

Sample output:

[...]
-disk
       description: ATA Disk
       product: ST9500325AS
       physical id: 0
       bus info: scsi@0:0.0.0
       logical name: /dev/sda
       version: DEM1
       serial: 5VEQTRV0
       size: 465GiB (500GB)
       capabilities: partitioned partitioned:dos
       configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=8dd04bfd
[...]
View Hard Disk Drive Details In Linux Using lshw

View Hard Disk Drive Details In Linux Using lshw

To  display only the name of the disks, run:

$ sudo lshw -short -C disk

Sample output:

H/W path                 Device           Class          Description
====================================================================
/0/100/1d/1/1/6/0.0.0    /dev/sdb         disk           Multi-Card
/0/100/1d/1/1/6/0.0.0/0  /dev/sdb         disk           
/0/100/1f.2/0            /dev/sda         disk           500GB ST9500325AS
/0/100/1f.2/1            /dev/cdrom       disk           DVD+-RW DS-8A8SH

For more details, check man pages.

$ man lshw

3. inxi

Inxi is yet another full-featured command line system information tool. It shows system hardware, CPU, drivers, Xorg, Desktop, Kernel, GCC version(s), Processes, RAM usage, and a wide variety of other useful information. Be it a hard disk or CPU, mother board or the complete detail of the entire system, inxi will get them for you more accurately in seconds.

3.1. Install inxi in Linux

Inxi is also available in the default repositories of most Linux distributions.

For Arch Linux, it is available in AUR. You can install it using any AUR helper programs, for example Yay.

$ yay -S inxi

On Debian, Uubntu:

$ sudo apt install inxi

On Fedora:

$ sudo dnf install inxi

On CentOS and RHEL:

Enable [EPEL] repository using the following command:

$ sudo dnf install epel-release
$ sudo dnf install inxi

On openSUSE:

$ sudo zypper install inxi

3.2. Display Hard Disk Drive Details In Linux Using Inxi

To get the details of the installed hard disk drives in your Linux system, run:

$ inxi -D

Sample output:

Drives:    Local Storage: total: 465.76 GiB used: 376.31 GiB (80.8%) 
           ID-1: /dev/sda vendor: Seagate model: ST9500325AS size: 465.76 GiB
Display Hard Disk Drive Details In Linux Using Inxi

Display Hard Disk Drive Details In Linux Using Inxi

You can also display more disk details like disk controller speed, serial no and temperature using the following command:

$ inxi -Dxx

Sample output:

Drives:    Local Storage: total: 465.76 GiB used: 332.10 GiB (71.3%) 
           ID-1: /dev/sda vendor: Seagate model: ST9500325AS size: 465.76 GiB speed: 3.0 Gb/s serial: 5VEQTRV0 temp: 46 C

Unlike Hdparm and lshw programs, it will only display the hard disk drive details. The hdparm and lshw utilities will display all drive details including CD/DVD ROM.

For more details, refer man pages.

$ man inxi

Suggested read:


4. Smartctl

Smartclt is a command line, control and monitor utility for SMART disks. It controls the Self-Monitoring, Analysis and Reporting Technology (shortly SMART) system built into most ATA/SATA and SCSI/SAS hard drives and solid-state drives. Smartclt command is part of the smartmontools package, which comes pre-installed in most Linux versions.

4.1. Get Hard Disk Drive Details In Linux Using Smartctl

To fetch the complete details about the hard disk drive in your Linux box, run:

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

Sample output:

smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-29-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family: Seagate Momentus 5400.6
Device Model: ST9500325AS
Serial Number: 5VEQTRV0
LU WWN Device Id: 5 000c50 048fe5ff9
Firmware Version: D005DEM1
User Capacity: 500,107,862,016 bytes [500 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: 5400 rpm
Device is: In smartctl database [for details use: -P show]
ATA Version is: ATA8-ACS T13/1699-D revision 4
SATA Version is: SATA 2.6, 3.0 Gb/s
Local Time is: Mon May 11 16:35:54 2020 IST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
[...]
Get Hard Disk Drive Details In Linux Using Smartctl

Get Hard Disk Drive Details In Linux Using Smartctl

For more details, refer man pages.

$ man smartctl

5. Check Hard Disk Drive Details In Linux Using Lsblk

Lsblk is a command line utility to display all available or the specified block devices in Unix-like operating systems. It reads the "sysfs" filesystem and "udev db" to gather information. The lsblk command is part of the "util-linux" package, which comes pre-installed in most Linux distributions.

To display all block devices using lsblk command, run:

$ lsblk -io KNAME,TYPE,SIZE,MODEL

Sample output:

KNAME  TYPE   SIZE MODEL
loop0  loop 154.3M 
loop1  loop 154.3M 
loop2  loop  93.8M 
loop3  loop  93.9M 
loop4  loop    55M 
loop5  loop    55M 
loop6  loop   149M 
loop7  loop 140.7M 
loop8  loop 156.7M 
loop9  loop 255.6M 
loop10 loop 160.2M 
loop11 loop   2.4M 
loop12 loop   2.4M 
loop13 loop 140.7M 
loop14 loop 242.4M 
loop15 loop  14.8M 
loop16 loop   276K 
loop17 loop   956K 
loop18 loop   956K 
loop19 loop   3.7M 
loop20 loop   2.2M 
loop21 loop  54.8M 
loop22 loop  62.1M 
loop23 loop 199.4M 
loop24 loop   203M 
sda    disk 465.8G ST9500325AS
sda1   part 465.8G 
sr0    rom   1024M PLDS_DVD+_-RW_DS-8A8SH

You can even display more details including filesystem type, UUID, Mountpoint etc., like below:

$ lsblk -io KNAME,TYPE,SIZE,MODEL,FSTYPE,UUID,MOUNTPOINT

Sample output:

KNAME  TYPE   SIZE MODEL                  FSTYPE   UUID                                 MOUNTPOINT
loop0  loop 154.3M                        squashfs                                      /snap/chromium/1135
loop1  loop 154.3M                        squashfs                                      /snap/chromium/1143
loop2  loop  93.8M                        squashfs                                      /snap/core/8935
loop3  loop  93.9M                        squashfs                                      /snap/core/9066
loop4  loop    55M                        squashfs                                      /snap/core18/1705
loop5  loop    55M                        squashfs                                      /snap/core18/1754
loop6  loop   149M                        squashfs                                      /snap/gifcurry/8
loop7  loop 160.2M                        squashfs                                      /snap/gnome-3-28-1804/116
loop8  loop 156.7M                        squashfs                                      /snap/gnome-3-28-1804/110
loop9  loop   2.2M                        squashfs                                      /snap/gnome-system-monitor/145
loop10 loop 242.4M                        squashfs                                      /snap/gnome-3-34-1804/27
loop11 loop 140.7M                        squashfs                                      /snap/gnome-3-26-1604/98
loop12 loop 140.7M                        squashfs                                      /snap/gnome-3-26-1604/97
loop13 loop   3.7M                        squashfs                                      /snap/gnome-system-monitor/135
loop14 loop  54.8M                        squashfs                                      /snap/gtk-common-themes/1502
loop15 loop 255.6M                        squashfs                                      /snap/gnome-3-34-1804/33
loop16 loop  62.1M                        squashfs                                      /snap/gtk-common-themes/1506
loop17 loop   203M                        squashfs                                      /snap/multipass/2037
loop18 loop 208.8M                        squashfs                                      /snap/multipass/2053
sda    disk 465.8G ST9500325AS                                                          
sda1   part 465.8G                        ext4     3968763a-adde-46e0-ae93-e2a1e51120da /
sr0    rom   1024M PLDS_DVD+_-RW_DS-8A8SH

If you want to display only the physical devices, use "-d" flag.

$ lsblk -ido KNAME,TYPE,SIZE,MODEL
Check Hard Disk Drive Details In Linux Using Lsblk

Check Hard Disk Drive Details In Linux Using Lsblk

6. Find Hard Disk Drive Details In Linux Using Fdisk and Sfdisk Commands

Fdisk and Sfdisk commands are used to create and manipulate partition tables. fdisk is a dialog-driven program for creating and manipulating partition tables whereas sfdisk is a script-oriented tool for partitioning any block device. Both are part of util-linux package which comes pre-installed in all Linux distros.

To get the HDD details, run fdisk as root or sudo user with "-l" flag:

$ sudo fdisk -l

Sample output:

[...]
Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST9500325AS     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8dd04bfd

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1  *     2048 976771071 976769024 465.8G 83 Linux
[...]
Find Hard Disk Drive Details In Linux Using Fdisk

Find Hard Disk Drive Details In Linux Using Fdisk

The usage of Sfdisk is same as fdisk. To list HDD details using Sfdisk, run it with -l flag with root or sudo privileges:

$ sudo sfdisk -l

To exclude the details of dm (device mapper) devices from the output, run:

$ sudo fdisk -l /dev/sd?

Or,

$ sudo sfdisk -l /dev/sd?

Sample output:

Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: ST9500325AS     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8dd04bfd

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1  *     2048 976771071 976769024 465.8G 83 Linux

7. Find Hard Disk Drive Details In Linux Using /proc

The /proc is a special virtual filesystem in Unix-like distributions. It is also known as process information pseudo-file system. It doesn't contain any 'real' files but runtime system information such as processes, system memory, mounted devices and hardware configuration etc. Each device details are stored in a separate directory under /proc directory. The storage devices' details will be available in "/proc/scsi/scsi" file.

$ cat /proc/scsi/scsi

Sample output:

Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: ST9500325AS      Rev: DEM1
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
  Vendor: PLDS     Model: DVD+-RW DS-8A8SH Rev: KD11
  Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi6 Channel: 00 Id: 00 Lun: 00
  Vendor: Generic- Model: Multi-Card       Rev: 1.00
  Type:   Direct-Access                    ANSI  SCSI revision: 00

8. Hwinfo

Hwinfo is a free, open source and command line utility to find Linux system hardware information. It probes for the hardware present in a Linux system and displays the extensive details of each hardware device. It uses libhd.so library to gather details of almost all hardware such as BIOS, CPU, Architecture, Memory, Hard Disk(s), Partitions, Camera, Bluetooth, CD/DVD drives, Keyboard/Mouse, Graphics card, Monitor, Modem, Scanner, Printer, PCI, IDE, SCSI, Sound card, Network interface card, USB and a lot more.

8.1. Install Hwinfo In Linux

Refer the following link to install Hwinfo in your Linux system.

8.2. Find Hard Disk Drive Details In Linux Using Hwinfo

To find Hard disk drive details using Hwinfo, run:

$ sudo hwinfo --disk

Sample output:

[...]
19: IDE 00.0: 10600 Disk
  [Created at block.245]
  Unique ID: 3OOL.lJ6EpAAhNoC
  Parent ID: w7Y8.V9XImrUYE44
  SysFS ID: /class/block/sda
  SysFS BusID: 0:0:0:0
  SysFS Device Link: /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0
  Hardware Class: disk
  Model: "ST9500325AS"
  Device: "ST9500325AS"
  Revision: "DEM1"
  Serial ID: "5VEQTRV0"
  Driver: "ahci", "sd"
  Driver Modules: "ahci"
  Device File: /dev/sda
  Device Number: block 8:0-8:15
  Geometry (Logical): CHS 60801/255/63
  Size: 976773168 sectors a 512 bytes
  Capacity: 465 GB (500107862016 bytes)
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #2 (SATA controller)
[...]
Find Hard Disk Drive Details In Linux Using Hwinfo

Find Hard Disk Drive Details In Linux Using Hwinfo

Or you can display the short summary of the disk details:

$ sudo hwinfo --short --disk

Sample output:

disk:                                                           
  /dev/sdb             Generic Multi-Card
  /dev/sda             ST9500325AS
                       Realtek RTS5138 Card Reader Controller

9. GNOME Disks

Disks or Gnome-disk-utility is a graphical user interface program to view, modify and configure available storage devices and media in a Linux system. If you are not comfortable with command line way, you can use use GNOME Disks to create and restore disk images, partition and format drives, inspect drive speed, benchmark drives and check health status etc. It comes pre-installed in all Linux distributions that has GNOME desktop environment.

9.1. Find Hard Disk Drive Details In Linux Using GNOME Disks

Launch Disks either from Menu or Dash. It lists all available disks and media in your Linux system.

Find Hard Disk Drive Details In Linux Using GNOME Disks

Find Hard Disk Drive Details In Linux Using GNOME Disks


Suggested read:


Hope this helps.

Featured Image by Clker-Free-Vector-Images from Pixabay.

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More