HowTo: Find Out Hard Disk Specs / Details on Linux

by on October 11, 2007 · 6 comments· LAST UPDATED February 24, 2012

in , ,

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 read / request identification information such as disk size, description and much more directly from the drive, which is displayed in a new expanded format.

hdparm Command

Open the terminal and type the following command to find information about /dev/sda:
# hdparm -I /dev/sda
OR
$ sudo hdparm -I /dev/sda
Sample outputs:

/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
Sample outputs:

  *-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

Find Out Disks Name Only

The following 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

Linux GUI Disk Utility

Gnome users can use the gnome-disk-utility for the following purposes:

  • Get information about installed disks and its current health.
  • Manage and configure disk drives.
  • Manage and configure media.
  • Manage and configure software RAID devices.

Type the following command or start Disk utility by visiting Applications > System Tools > Disk Utility :
$ palimpsest
Sample outputs:

Linux List Hard Drives GUI Tool & Command

Fig.01: Linux List Hard Drives GUI Tool & Command - Click to enlarge


You can view disk health by clicking on the "Smart data" button (see smartd for more information):

How to determine the storage type in linux

Fig.02: Samrtdata about hard disk

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
Sample outputs:

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.

A Note About RAID and SCSI Disks

Try the following commands for SCSI and hardware RAID based devices:

  1. sdparm Command - fetch SCSI / SATA device information.
  2. scsi_id Command - queries a SCSI device via the SCSI INQUIRY vital product data (VPD).
  3. Use smartctl To Check Disk Behind Adaptec RAID Controllers
  4. Use smartctl Check Hard Disk Behind 3Ware RAID Card

See also:

To get more information about your hard disk, refer to our other articles:

Page last updated at 5:24 AM, February 24, 2012.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 6 comments… read them below or add one }

1 Irfan Kazi August 17, 2009 at 1:44 am

I think the mentioned command can NOT be used on SCSI hard disks e.g. sda, sdb

Reply

2 anil singh rana January 23, 2012 at 3:57 am

dear

how to found linux volume id list in a system or a online

Reply

3 Jozsef February 24, 2012 at 5:06 am

@anil
Is this what you are looking for?
ls -lF /dev/disk/by-id/

Reply

4 Sharad Galande February 24, 2012 at 6:09 am

I am facing below error while while initiating “hdparm” cmd on my CentOS5 box.

[root@centos ~]# hdparm -I /dev/sda
/dev/sda:
HDIO_DRIVE_CMD(identify) failed: Invalid argument

Reply

5 Joe November 2, 2012 at 5:52 pm

I’m getting the same error.

Also, for what it’s worth, if you don’t have hdparm in your $PATH, it’s located in /sbin. ;)

Reply

6 henryg November 16, 2012 at 2:15 pm

“blkid” will show you a list of disks with device info, label and format type

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: