Names for ATA and SATA disks in Linux

All we need is an easy explanation of the problem, so here it is.

Assume that we have two disks, one master SATA and one master ATA. How will they show up in /dev?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Depending on your SATA driver and your distribution’s configuration, they might show up as /dev/hda and /dev/hdb, or /dev/hda and /dev/sda, or /dev/sda and /dev/sdb. Distributions and drivers are moving towards having everything hard disk called sd?, but PATA drivers traditionally used hd? and a few SATA drivers also did.

The device names are determined by the udev configuration. For example, on Ubuntu 10.04, the following lines from /lib/udev/rules.d/60-persistent-storage.rules make all ATA hard disks appear as /dev/sd* and all ATA CD drives appear as /dev/sr*:

# ATA devices with their own "ata" kernel subsystem
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode"
# ATA devices using the "scsi" subsystem
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode"

Method 2

If I’m understanding your question correctly, the first parallel ATA hard drive under Linux will be /dev/hda, the second will be /dev/hdb, followed by /dev/hdc, etc.

Serial ATA devides will show up the same way SCSI and USB devices do: /dev/sda will be the first one, followed by /dev/sdb, /dev/sdc/, etc.

Method 3

  • SATA – /dev/sdX
  • SSD – /dev/sdX
  • SCSCi – /dev/sdX
  • IDE – /dev/hda

Any drive which start with S (sata,ssd,scsci) is sda and IDE is hda

Method 4

Other answers discuss SATA, IDE, SCSI, etc, but I thought I’d add the new NVMe. In modern kernels, NVMe drives use /dev/nvmeXnY for a drive, and /dev/nvmeXnYpZ for partitions. For example, partition 5 on NVMe drive (0, 1) would be /dev/nvme0n1p5. The block devices behave just like the hdX and sdX drives.

Essentially, parrallel connections use hdX and serial connections use sdX, and NVMe, the oddball, uses nvmeXnY

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply