How can I tell if my hard drive is PATA or SATA?

10,782

Solution 1

To see the device description for the controller (assuming an internal (PCI) controller), which usually contains SATA for SATA controllers:

lspci -d $(cat /sys/block/sda/device/../../../vendor):$(cat /sys/block/sda/device/../../../device)

If you want to type less, just browsing the output of lspci is likely to give you the answer in a laptop (many desktop have both kinds of interfaces so you'd have to look up the drive you're interested in).

If that doesn't give you the answer, to see what driver is providing sda (you can then look up whether that driver is for a PATA or SATA controller):

readlink -f /sys/block/sda/device/../../../driver

Solution 2

Update: For the record, @Gilles answer is better.

If it's a PATA (ide) drive, then you will see it under /proc/ide. Here is my IDE DVD-Drive, for example, here is my output:

$ cat /proc/ide/hdb/model 
Optiarc CDRWDVD CRX890A

If it is a SATA drive, it will show up under /proc/scsi. You might be surprised to find it under 'scsi'. I forget the exact reason (I'm going to ask that in another question), but I think that is because SATA uses the SCSI drivers.

Here's a list showing a SATA drive on my system:

$ cat /proc/scsi/scsi 
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD2500AAJS-6 Rev: 01.0
  Type:   Direct-Access                    ANSI  SCSI revision: 05
Share:
10,782

Related videos on Youtube

Hugo
Author by

Hugo

Updated on September 17, 2022

Comments

  • Hugo
    Hugo over 1 year

    I have an ATA hard disk in my laptop, running Fedora 11, kernel 2.6.30.10-105.2.23.fc11.i586. I am looking to upgrade the disk in here (would love to get an SSD) but I forgot if it's a serial ATA or an old parallel ATA interface. There's not much use upgrading to an SSD if it's PATA...

    How can I tell if the disk is connected via a PATA or an SATA interface?

  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 13 years
    This isn't always reliable: depending on the driver, kernel version and kernel compilation options, some SATA drivers can appear as ide and some PATA drivers can appear as scsi. Modern kernels tend to have every driver speak scsi to the generic disk layer, and that's what you see here.
  • Hugo
    Hugo over 13 years
    Awesome, thanks! The first command confused me but the second one nicely produced /sys/bus/pci/drivers/pata_amd !
  • Hugo
    Hugo over 13 years
    Yeah, sorry Stefan, the drive is listed under /proc/scsi/scsi, in fact my system doesn't even have /proc/ide... yet according to Gilles' answer, it looks like the drive is actually IDE.
  • starfry
    starfry almost 6 years
    @Gilles - Looking for this information in 2018, the above does not work (at least on my Arch Linux system). The paths don't exist (no vendor file, etc).
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 6 years
    @starfry What bus is it on? I think my answer works for any non-antique Linux kernel, but it wouldn't work for device that isn't connected to an ATA controller which is on a PCI bus. For example I'm not sure if it would work for an SSD, depending on the type of controller.
  • starfry
    starfry almost 6 years
    kernel 4.15.3-2-ARCH, device example pci-0000:00:1f.2-ata-1 . Doing ls /sys/block/sdc/device/../../../ yields ata_port firmware_node host2 link3 power uevent. All normal spinning hard drives on standard SATA ports on a 2009 i7 motherboard.