Tech Tip: Retrieve Disk Info from the Command Line


You can use the following command line tools to retrieve the make and model of your hard drives without the need to open up your system.

First, you need the device names of your disks, for this you can use df or cat /proc/partitions. Example device names are names such as /dev/hda or /dev/sdb. For the following examples, where applicable, I will use /dev/sda as my disk device.

Use the lshw command:

$ lshw -class disk
       product: ST3250310NS
       vendor:  Seagate
       version: SN04
       serial:  9SF0000TH
       size:    232GiB (250GB)

Use the smartctl command:

$ smartctl -i /dev/sda
Device Model:     ST3250310NS
Serial Number:    9SF0000TH
Firmware Version: SN04

Note: You may need to install the 'smartmontools' package, your output will vary depending on smartctl version and disk make/model.

Use the hdparm command:

$ hdparm -i /dev/sda


 Model=ST3250310NS, FwRev=SN04, SerialNo=9SF0000TH

Use the hwinfo command:

$ hwinfo --disk
Model:     "ST3250310NS"
Device:    "ST3250310NS"
Revision:  "SN04"
Serial ID: "9SF0000TH"

Note: You may need to install the 'hwinfo' package.

Note, you will need to be root to get the full output from these commands.

And one additional way that you can determine the model and serial number of your disk:

$ ls /dev/disk/by-id


Here the model number is ST3250310NS, and the serial number is 9SF0000TH.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

There is some error while

Catherine Thompson's picture

There is some error while displaying page. I can't able to read...... Help!!!!

here's a "one-liner" that

Anonymous's picture

here's a "one-liner" that makes use of standard utils (find, grep, etc.) when the above commands aren't available or are lacking:

for file in $(find /sys/block/[sh][dr]*/device/ /sys/block/[sh][dr]*/ -maxdepth 1 2>/dev/null|egrep '(vendor|model|/size|/sys/block/[sh][dr]./$)'|sort); do [ -d $file ] && echo -e "\n -- DEVICE $(basename $file) --" && continue; grep -H . $file|sed -e 's|^/sys/block/||;s|/d*e*v*i*c*e*/*\(.*\):| \1 |'|awk '{if($2 == "size") {printf "%-3s %-6s: %d MB\n", $1,$2,(($3 * 512)/1048576)} else {printf "%-3s %-6s: ", $1,$2;for(i=3;i<NF;++i) printf "%s ",$i;print $(NF) };}';done


Mitch Frazier's picture

For better viewing:

for file in \
        $(find /sys/block/[sh][dr]*/device/ /sys/block/[sh][dr]*/ -maxdepth 1 2>/dev/null | \
              egrep '(vendor|model|/size|/sys/block/[sh][dr]./$)'|sort)
    [ -d $file ] && \
        echo -e "\n -- DEVICE $(basename $file) --" && \

    grep -H . $file | \
        sed -e 's|^/sys/block/||;s|/d*e*v*i*c*e*/*\(.*\):| \1 |' | \
        awk ' {
                  if ( $2 == "size" ) {
                      printf "%-3s %-6s: %d MB\n", $1,$2,(($3 * 512)/1048576)
                  else {
                      printf "%-3s %-6s: ", $1,$2
                      for ( i=3; i

p.s. A "one liner"...? Don't be afraid of the guys in the white coats, they're here to help.

Mitch Frazier is an Associate Editor for Linux Journal.

they're coming to take me

Anonymous's picture

they're coming to take me away...ha ha ho ho hee hee...

Some others

Chris Cox's picture

On newer implementation of the kernel, sysfs will have vendor, model, rev at /sys/block/sda/ and /sys/block/sda/device...

sginfo -a /dev/sda
can show a lot of info

Just some other options...