8

I need to find out if a disk is IDE or SATA (or anything else, maybe). I know that the device is /dev/sda, so I think it's SATA, but I don't know if I can be sure just by the name. I tried looking at dmesg and it always says "SCSI", but I'm sure it's not...

any ideas?

2
  • I am facing the same problem. Executing lshw doesn't seem to give the correct details.
    – Amit
    Jun 20, 2013 at 12:43
  • i am also facing the same problem... May 5, 2016 at 10:56

7 Answers 7

13

Interesting question. dmesg should have something like this if it's a SATA drive:

 dmesg | grep -i SATA
 [    3.972803] ata3: SATA max UDMA/133 cmd 0xe800 ctl 0xe400 bmdma 0xd800 irq 18
 [    3.972807] ata4: SATA max UDMA/133 cmd 0xe000 ctl 0xdc00 bmdma 0xd808 irq 18

I then grep'ed the dmesg output for "ata3" and found the serial number:

dmesg | grep -in ata3
397:[    3.972803] ata3: SATA max UDMA/133 cmd 0xe800 ctl 0xe400 bmdma 0xd800 irq 18
409:[    4.183701] ata3.00: ATA-7: ST3160812AS, 3.ADH, max UDMA/133
410:[    4.183706] ata3.00: 312500000 sectors, multi 16: LBA48 NCQ (depth 0/32)
411:[    4.267004] ata3.00: configured for UDMA/133

which could then be looked up smartctl or hdparm -i /dev/<your disk(s)> to match serial with device.

I'm sure someone with l33t shell scripting skillz could do this all up on one line, but this should be pretty solid. If any doubts, I'd check the serial number against the manufacturer's Website as Madhatter suggested.

I ran the same dmesg | grep -i SATA on Ubuntu running on a VMware virtual machine (which treats the virtual drives as SCSI) and a server with SCSI disks; both returned nothing.

5

One pretty reliable method is to use lshw to lookup the model number and then to lookup the model number on Google to see what type of device it is. This method doesn't work if the drive is in a USB enclosure, some USB controllers hide the HD info from you.

So for this system you would do a search on ST31500341AS. and find that it is a 1.5TB SATA drive.

root@pabil:# lshw -class disk
  *-disk:0                
       description: ATA Disk
       product: ST31500341AS
       vendor: Seagate
       physical id: 0
       bus info: scsi@0:0.0.0
       logical name: /dev/sda
       version: CC1H
       serial: 9VS0R1WB
       size: 1397GiB (1500GB)
       capabilities: partitioned partitioned:dos
       configuration: ansiversion=5 signature=000473f5
2
  • Kind of a dupe of MadHatter's answer.
    – gravyface
    Oct 25, 2010 at 17:06
  • 1
    @gravyface, I suppose, but on several Linux distros I believe lshw is in the base install but smartctl requires adding a package. Also lshw is a more generic tool that can be used to gather other information about the system.
    – Zoredache
    Oct 25, 2010 at 17:20
2

If it were IDE, it would very likely show up as /dev/hda. You could try smartctl -a /dev/sda which will produce a lot of information including manufacturer and model number; cross-referencing that on the manufacturer's website is usually fairly simple.

3
  • I should add that the smartctl command is safe to use on a running system (at least, the manual doesn't say it's not, which it does when there are known issues, and it's never gone wrong for me).
    – MadHatter
    Oct 25, 2010 at 13:48
  • This is not always the case with Ubuntu. On my home server, running Ubuntu 8.10, all 3 of my disks are /dev/sda, (SATA) /dev/sdb, (SATA) /dev/sdc (IDE).
    – gravyface
    Oct 25, 2010 at 14:47
  • As I said, "very likely". I've never known a system not do it, but then I've never run ubuntu, so thought caution was in order - and I was right. THANK YOU for posting more information!
    – MadHatter
    Oct 25, 2010 at 14:56
2

MadHatter is right in that the designation difference would be /dev/hdx versus /dev/sdx. But the surest way is to open the case and look at the cable. You don't necessarily need to shut off the machine to do that, depending on the system you're looking at and what kind of tangled nest of cables you have around the case.

If the system can be rebooted you could use the Ultimate Boot CD to run a hard disk diagnostic, they normally identify the drive type and model. Even the BIOS might tell you at reboot what kind of drive it is.

2

Look at the cables/connectors or look at dmesg.

You cannot rely on /dev/hd for PATA drives. For modern systems all PATA/SATA drives will show up as /dev/sd because the new ATA layer uses the sd prefix. You will only see /dev/hd if your OS uses the old deprecated ATA drivers.

1
  • Interesting to know. I did some Googling and sometime around Ubuntu 6.x (~2007) there was some bugs as the new layer changes you've suggested weren't changed in fstab and some users couldn't boot. I'm running 8.10, and all my drives are /dev/sd. However, even recent Ubuntu documentation seems to suggest that /dev/hd is for IDE drives and /dev/sd is for SATA/SCSI. I don't have Ubuntu 10.x running on any systems with IDE drives, but seems like an odd discrepancy.
    – gravyface
    Oct 25, 2010 at 15:25
1

I realize this post is old (Linux now lumps IDE/PATA drives in with /dev/sd?) but the easiest way to do this nowadays is

sudo hdparm -I /dev/sd? | grep 'sd.\|ATA'

Which gives the following output for a system with one SATA and one PATA drive:

/dev/sda:
ATA device, with non-removable media
        Transport: Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6
/dev/sdb:
ATA device, with non-removable media
        Used: ATA/ATAPI-6 T13 1410D revision 3a 
0

If you run sudo hdparm -I /dev/sdX | grep Gen, it should give you output something like this on a SATA drive. Not got IDE or SCSI I can test with, but should be different on them, as SATA has different speeds.

` sudo hdparm -I /dev/sda | grep Gen

   *    General Purpose Logging feature set
   *    Gen1 signaling speed (1.5Gb/s)
   *    Gen2 signaling speed (3.0Gb/s)`

You must log in to answer this question.

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