Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Linux box with five disk drives, one of which I want to replace. The offending drive is /dev/sdc, but that doesn't tell me how to distinguish the hardware. The drive is SATA and the assignment of drives to devices sometimes changes after a boot.

I'd like to be able to use the model names printed on the disk. I know these names are machine-readable because they are the names the BIOS uses.

Is there a way, using Linux, to find out the model number of /dev/sdc, or even the model numbers of all the drives in the system?

share|improve this question
up vote 11 down vote accepted

Try the hdparm program:

# hdparm -i /dev/sdc
/dev/sda:

 Model=INTEL SSDSA2CW080G3, FwRev=4PC10362, SerialNo=CVPR112003RA080BGN
...

The -i option of hdparm can be used to retrieve identification information.

share|improve this answer

I'm not sure if it's on all distros, but try looking into /dev/disk/by-id:

$ ls -l /dev/disk/by-id/
razem 0
lrwxrwxrwx 1 root root  9 08-08 14:45 ata-HL-DT-STDVD-RAM_GH22NS30 -> ../../sr0
lrwxrwxrwx 1 root root  9 08-08 14:45 ata-ST31000528AS_9VP8RZQM -> ../../sda
lrwxrwxrwx 1 root root 10 08-08 14:45 ata-ST31000528AS_9VP8RZQM-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 08-08 14:45 ata-ST31000528AS_9VP8RZQM-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 08-11 05:27 ata-ST31000528AS_9VP8RZQM-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 08-08 14:45 ata-ST31000528AS_9VP8RZQM-part7 -> ../../sda7
lrwxrwxrwx 1 root root  9 08-08 14:45 ata-ST3500630A_9QG9YH73 -> ../../sdb
lrwxrwxrwx 1 root root 10 08-08 14:45 ata-ST3500630A_9QG9YH73-part1 -> ../../sdb1
lrwxrwxrwx 1 root root 10 08-11 02:56 ata-ST3500630A_9QG9YH73-part2 -> ../../sdb2
lrwxrwxrwx 1 root root 10 08-08 12:45 ata-ST3500630A_9QG9YH73-part3 -> ../../sdb3
lrwxrwxrwx 1 root root 10 08-08 12:45 ata-ST3500630A_9QG9YH73-part5 -> ../../sdb5
lrwxrwxrwx 1 root root  9 08-08 14:45 wwn-0x5000c5002737ee0c -> ../../sda
lrwxrwxrwx 1 root root 10 08-08 14:45 wwn-0x5000c5002737ee0c-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 08-08 14:45 wwn-0x5000c5002737ee0c-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 08-11 05:27 wwn-0x5000c5002737ee0c-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 08-08 14:45 wwn-0x5000c5002737ee0c-part7 -> ../../sda7

You can also try grepping dmesg for the device name:

# dmesg|grep -C3 sda
[    2.387103] ata6.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[    2.388346] ata6.00: configured for UDMA/133
[    2.388418] scsi 5:0:0:0: Direct-Access     ATA      ST31000528AS     CC38 PQ: 0 ANSI: 5
[    2.388611] sd 5:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[    2.388653] sd 5:0:0:0: [sda] Write Protect is off
[    2.388656] sd 5:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    2.388664] sd 5:0:0:0: Attached scsi generic sg1 type 0
[    2.388669] sd 5:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.448514]  sda: sda1 
[    2.448985] sd 5:0:0:0: [sda] Attached SCSI disk
[    2.449040] scsi 8:0:0:0: Direct-Access     ATA      ST3500630A       3.AA PQ: 0 ANSI: 5
[    2.449189] sd 8:0:0:0: [sdb] 976771055 512-byte logical blocks: (500 GB/465 GiB)
[    2.449225] sd 8:0:0:0: [sdb] Write Protect is off
--

In this case it's ST31000528AS.

share|improve this answer
    
Amazing! No external utilities required. A true solution. – darnir Aug 11 '12 at 14:09

try running:

$ sudo lshw

It will give you a long output regarding your hardware, the one that concerns you will look similar to this:

 *-scsi:0
          physical id: 0
          logical name: scsi0
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: WDC WD3200BEVT-7
             vendor: Western Digital
             physical id: 0.0.0
             bus info: scsi@0:0.0.0
             logical name: /dev/sda
             version: 01.0
             serial: WD-WX81A30C3330
             size: 298GiB (320GB)
             capabilities: partitioned partitioned:dos
             configuration: ansiversion=5 sectorsize=512 signature=9f7685a8
           *-volume:0
                description: Linux filesystem partition
                vendor: Linux
                physical id: 1
                bus info: scsi@0:0.0.0,1
                logical name: /dev/sda1
                logical name: /boot
                version: 1.0
                serial: aa84c5a8-6408-4952-b577-578f2a67af86
                size: 141MiB
                capacity: 141MiB
                capabilities: primary extended_attributes ext2 initialized
                configuration: filesystem=ext2 label=boot lastmountpoint=/boot modified=2012-08-11 17:03:06 mount.fstype=ext2 mount.options=rw,relatime mounted=2012-08-11 12:25:38 state=mounted

Notice that it mentions your block device id as logical name and also the serial number as product. You can use this to physically distinguish your drives

share|improve this answer
    
Looks useful but lshw is not actually installed on my system. – Norman Ramsey Aug 11 '12 at 14:06
    
Okay. I use lshw to gain whatever information I require about the hardware of any system. Very convenient. – darnir Aug 11 '12 at 14:07
    
This method worked fine in a case where hdparm and dmesg didn't provide the information. (WD My Passport disk on Debian jessie.) – Diomidis Spinellis Jun 2 at 10:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .