9

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?

12

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.

| improve this answer | |
7

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.

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

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

| 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 '16 at 10:29
  • I prefer the -html option to lshw - ie, lshw -html, redirect it to a file, and that way you can look at it in a browser (with search functions, etc) – ivanivan Jul 2 '17 at 19:43
4

If you have lsblk installed on your system, you can use this command:

lsblk -o MODEL,SERIAL,SIZE,STATE --nodeps

This will return a columnar display like the one shown below with model number, manufacturer's serial number, disk size, and state. It can be scripted to allow you to access remote machines, too. You must be root to use it, though.

MODEL            SERIAL         SIZE STATE
FUJITSU MHZ2320B K618T913BPHU 298.1G running
External         W3PEEC6T     465.8G running
DVDRW  DR-TD08HB               1024M running
| improve this answer | |
  • You don't need root privilages for it. I think it's crucial to add "NAME" option, like this: lsblk -o NAME,MODEL,SERIAL,SIZE,STATE --nodeps, so that you know if that FUJITSU is sda or sdb. We are asking "which drive is what", not "what drives do I have". – styrofoam fly Jul 2 '17 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.