I want to know which hard disk drive corresponds to which device path. It's trivial to match the hard disk stats (brand, size) with the dev path, but I want more. I want to know which drive is which inside my case. What's a good way to go about getting this info?


  • I am lazy. I don't want to tear apart my server to remove all the drives, then add back one by one.
  • Reboots are acceptable.
  • The drives are inconveniently scrunched together in the case. The label information is hidden.
  • The case can be opened. Most disks are SATA, so theoretically hot swappable. Unplugging cables is fair game.


I'll award answer to the best/easiest gui or cli answer, and give a bounty to the next-best answer of the other kind. I prefer a cli answer, but understand that a lot of other folks will appreciate a good point-and-click method.


10 Answers 10


Disk Utility

This is a GUI application that will give you information about the model, size, serial number and device path of your drives. It is installed by default on Ubuntu Desktop. You can press the Ubuntu Dash button and search "disk utility" to find it, or run it in the terminal with palimpsest.

Disk Utility

  • 4
    and you only need to use one hand and finger thats what I call energy conservation "save the planet use disk utility"
    – Allan
    Commented Feb 25, 2011 at 10:06
  • 4
    I think this will be the answer, with "Location: Port X of SATA Host Adapter" being the killer feature. I'd love to see some cli answers too though. Octavian & faustus have interesting solutions along those lines
    – djeikyb
    Commented Feb 25, 2011 at 11:19

hdparm -i /dev/sdX gives you the serial number, which is the simplest way I know of to tell apart hard disks of the same brand and size.

The serial number is normally printed on a label on the disk, so although you need to open the case to find it, there's no need disassemble the computer.


$ sudo hdparm -i /dev/sdb | grep -i serial
 Model=SAMSUNG HD253GJ, FwRev=1AJ10001, SerialNo=S24JJ90Z505435

If you want more info lshw -c storage -c disk gives the most readable output. It's pretty much the same data as Disk Utility, just in command line format.

Here is an annotated example from the most complex setup I have access to, with four disk controllers, seven hard disks, a DVD ROM and a USB disk.

The output has been cut down to size to focus on the interesting parts:

[server ~]$ sudo lshw -c storage -c disk
  # a 2-port PCI-E SATA controller
       description: SATA controller
       product: 88SE9123 PCIe SATA 6.0 Gb/s controller
       vendor: Marvell Technology Group Ltd.
          description: ATA Disk
          product: WDC WD15EADS-00P
          vendor: Western Digital
  # 'physical id' corresponds to port number, first port is 0
          physical id: 0  
          logical name: /dev/sdg
          serial: WD-WMAVU0849124
          size: 1397GiB (1500GB)
          description: DVD reader
          product: BD-ROM BR-5100S
          vendor: Optiarc
          physical id: 1
          logical name: /dev/cdrom1
          logical name: /dev/dvd1
          logical name: /dev/scd0
          serial: [Optiarc BD-ROM BR-5100S 1.02 May20 ,2008
  # mobo controller for eSATA ports. Not used.
       description: SATA controller
       product: JMB362/JMB363 Serial ATA Controller
       vendor: JMicron Technology Corp.
  # mobo controller for IDE. Not used.
       description: IDE interface
       product: JMB362/JMB363 Serial ATA Controller
       vendor: JMicron Technology Corp.
  # the primary SATA controller, six ports
       description: SATA controller
       product: 82801JI (ICH10 Family) SATA AHCI Controller
       vendor: Intel Corporation
  # 'disk:0' means port 0, same as physical id
          description: ATA Disk
          product: WDC WD1600BEVS-0
          vendor: Western Digital
          physical id: 0
          logical name: /dev/sda
          serial: WD-WXEY08T58317
          size: 149GiB (160GB)
          description: ATA Disk
          product: ST32000542AS
          vendor: Seagate
          physical id: 1
          logical name: /dev/sdb
          serial: 5XW1RTDS
          size: 1863GiB (2TB)
          description: ATA Disk
          product: ST32000542AS
          vendor: Seagate
          physical id: 2
          logical name: /dev/sdc
          serial: 5XW23W0W
          size: 1863GiB (2TB)
  # the USB disk, as evidenced by the bus info 
       physical id: 1
       bus info: usb@1:1
       capabilities: emulated scsi-host
          description: SCSI Disk
          product: 10EAVS External
          vendor: WD
          physical id: 0.0.0
          logical name: /dev/sdh
          serial: WD-WCAU46029507
          size: 931GiB (1TB)

I think the Disk Utility is faster to read; the command line version has the advantage of being usable over ssh and in scripts.

And I still think the serial number is the most reliable solution :)

The "Physical ID" of each drive corresponds to where it is connected to the motherboard. and starts with 0. so a physical ID of 2 would mean that the drive is attached to the 3rd sata port of your mobo or other applicable device.

  • Interesting. The serial/label is nice to have, but in my scenario the disks are crammed in a holder that blocks the sticker from view. The best I can do is trace the cables. I didn't see anything in hdparm -i immediately useful, but I'll have to read through the man page to see if I can't get more info out of it.
    – djeikyb
    Commented Feb 25, 2011 at 11:54
  • Haha, the serial is indeed most reliable, but this gives the useful map of linux device recognition -> physical hookups...through a command line interface. Thanks!
    – djeikyb
    Commented Mar 7, 2011 at 23:37

Open the case and listen to the drives with a rolled up copy of "The Linux Journal". Then run a dd on each drive in turn to generate some disk noise.

  • 2
    Stethoscope ftw
    – Jeremy
    Commented Mar 6, 2011 at 5:28
  • 2
    Love this answer. I prefer the technical output of palimpsest and lshw, but this is a close third.
    – djeikyb
    Commented Mar 7, 2011 at 23:40
  • SSDs don't generate noise. Also, the solution won't work if you have more than one drive and there's other processes which read from two drives simultaneously. Commented Feb 3, 2017 at 15:09
  • Also , this won't help if you're working with a remote server via ssh or RDP Commented Feb 3, 2017 at 15:20
  • 2
    What could that "whooshing" sound be?
    – jjg
    Commented Feb 3, 2017 at 16:05

You can get that information from /sys (or /dev, for that matter):

anthony@Zia:~$ ls -l /sys/block/ | grep sd.
lrwxrwxrwx 1 root root 0 Feb 25 13:30 sda -> ../devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sda
lrwxrwxrwx 1 root root 0 Feb 25 13:30 sdb -> ../devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0/block/sdb
lrwxrwxrwx 1 root root 0 Feb 25 13:30 sdc -> ../devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0/block/sdc
lrwxrwxrwx 1 root root 0 Feb 25 13:30 sdd -> ../devices/pci0000:00/0000:00:1f.2/host5/target5:0:0/5:0:0:0/block/sdd

So, you can see my four disks are on ports (hosts/targets) 2 through 5.

You can also do the ls -l on /dev/disk/by-path and see it there.

  • 2
    +1 for accessing the basic info from /sys and /dev. I still like the aggregate info from the accepted solutions better, but knowing how to get and read the base info is invaluable. This is a missing part of the larger answer that @j-g-faustus and @Allan gave
    – djeikyb
    Commented Mar 11, 2011 at 1:12
  • In fact, if you run strace -e trace=open lsblk and strace -e trace=open lsblk, that's exactly the data that's being read. This answer deserves more upvotes. Commented Feb 3, 2017 at 15:18

I recommend hwinfo --disk.

This will list all relevant information for your hard disks. If you need more information about your partitions you can use hwinfo --partition.

You can combine both of the above with the --short option to get a shorter representation.

  • This looks most promising, especially the SysFS and Device Files lines, but I'm not sure how to translate them into english.
    – djeikyb
    Commented Feb 25, 2011 at 11:56

Hardinfo is a GUI which will allow you to gather your system Information, which may include, but not limited to, the physically connected Storage Devices and the File Systems, as shown in the next screenshots:

enter image description here

enter image description here

Hardinfo website: http://hardinfo.berlios.de/HomePage

  • cat /proc/partitions show detected partitions/disk by the kernel, you can figure out by the size

enter image description here

  • smartctl -i /dev/sda

enter image description here


Quickest and Easiest Way

1. Open Gnome-Terminal

2. Enter sudo blkid

3. Enter Password

4. It will tell you which drive is which in an easy to read format


If you want a way without being able to see the labels, which as far as I know none of the other responses do. I would unmount all of the drives (If possible, you may have to boot from a live cd to do this). All the drives should now spin down. You can then progressively mount each one and listen or feel which one spins up. This way you only need the lid off your case but you don't need to see tha labels which is nice if they're all tangled up.



Core question:

I want to know which hard disk drive corresponds to which device path.

Command-line approaches

  1. Basic and more hands-on approach is via examining /dev/ filesystem. There are several directories in /dev/disk/ which contain symlinks to device files, and those directories are organized on the UUID,id, path in /sys filesystem, and label (if device/partition has one). For instance, knowing UUID of the drive I wish to find, I could do something like this:

    $ find /dev/disk/by-uuid/ -mindepth 1 -printf "%p >>> %l\n"
    /dev/disk/by-uuid/8e344ab1-5eb5-4e20-becd-4147fffd439f >>> ../../sdb6
    /dev/disk/by-uuid/483CDA9D3CDA84FA >>> ../../sdb5
    /dev/disk/by-uuid/32AE5766AE5721A1 >>> ../../sdb4
    /dev/disk/by-uuid/7852-5217 >>> ../../sdb2
    /dev/disk/by-uuid/D668510B6850EC2D >>> ../../sdb1
    /dev/disk/by-uuid/B8E453D4E453940A >>> ../../sdb3
    /dev/disk/by-uuid/86df21bf-d95f-435c-9292-273bdbcba056 >>> ../../sda1
  2. Ubuntu comes by default with UDisks disk manager. It has couple of utilities one can use. The information from the method #1 is already parsed for user's convenience. For instance, to simply find which device corresponds to which hard drive model, we could do this:

    $ udisksctl  status
    MODEL                     REVISION  SERIAL               DEVICE
    Radeon R7                 1.01      A22MD061520000172    sda     
    TOSHIBA MQ01ABF050        AM0P3M    Z4GRCSXAT            sdb     

    Advanced info can be obtained via udisksctl info -b /dev/sda1 for specific device or udisksctl dump for all devices. udisksctl monitor can be used with connecting/disconnecting the drives physically.

In particular, if you want to match UUID with a specific drive, you could filter udisksctl info with grep:

    $ udisksctl info -b /dev/sda1 | grep 'IdUUID:\|Id:'                                                   
    Id:                         by-id-ata-Radeon_R7_A22MD061520000172-part1
    IdUUID:                     86df21bf-d95f-435c-9292-273bdbcba056

GUI approaches:

Using the information that UDisks puts out onto the interprocess communication bus known as dbus, I've written an indicator for Ubuntu with Unity desktop ( although it can be used on others as well ). Originally it was written for File System Usage Indicator (see the link for installation instructions ). It allows displaying information for all mounted drives conveniently and a few other features, such as clicking on partition/device and opening the corresponding directory in file manager.

enter image description here

  • There's lots of good info here. But your dev/sys fs advice begs the question: "how do I know which physical disk has a partition with this uuid". Which is what I asked in the first place.
    – djeikyb
    Commented Feb 3, 2017 at 18:28
  • @djeikyb That's actually one of the things that I was solving while working on the indicator I mentioned, and udisksctl is probably simplest approach - you can filter it with grep for the device + UUID lines. I'll edit it into my question. As for custom solutions, that of course it can be scripted with perl or python or even shell script, where you traverse /dev/disk/by-id and match it with symlinks in /dev/disk/by-uuid. Commented Feb 3, 2017 at 18:35
  • @djeikyb So, you basically want to know which connectors are used by which drive , right ? and without knowing the model or the hard drive ? Commented Feb 3, 2017 at 18:49
  • @djeikyb I've read that, and they focus on the serial number of each disk . . .which is what I also provided in udisksctl status part. Commented Feb 3, 2017 at 19:26
  • @djeikyb Interesting. Default Disks Utility, palimpset, has apparently been renamed as gnome-disks-utility, but it doesn't have the "Location" anymore. At least not in 16.04 that I'm running Commented Feb 3, 2017 at 19:48

You must log in to answer this question.

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