0

I am a bit confused with how linux hard drive/ storage device, block files are named.

My questions are:

  • How are IDE devices and partitions named?

  • How are EIDE devices and partitions named?

  • How are PATA devices and partitions named?

  • How are SATA devices and partitions named?

  • How are SCSI devices and partitions named?

Lastly, I have been reading articles on this subject, and I have seen mentions of 'master drives' and 'slave drives'. What are these, what are they used for, and how are they named?

  • 2
    Note that (E-)IDE and "PATA" are just different names for exactly the same thing. In fact, there's nothing that would be officially called "PATA", that's just an alias for IDE that people started using because it nicely mirrors "SATA". – TooTea Apr 6 at 11:35
8

Introduction

First of all, all the devices populate the /dev folder.

Also, it is important to note that (E)IDE and PATA terms usually refer to the same thing, which is the interface standard PATA. IDE and PATA are interchangable terms in this context.

There was a major change in naming conventions for block devices in Linux, around the release of Linux kernel version 2.6. The kernel supports all ATA devices through libATA, which started with SATA devices support in 2003 and was extended to current PATA support.

Therefore, be aware that, depending on your distribution and kernel version, the drives naming convention can differ.

Since a while, PATA devices on "modern" distributions are named the ways SATA drives are, since both are now using libATA.


For your distribution, you can find this in /lib/udev/rules.d/60-persistent-storage.rules.

On my system using Debian 9, it is also the case. For example:

$ cat /lib/udev/rules.d/60-persistent-storage.rules | grep "ATA"
# ATA
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", 
ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode"

By browsing this file, you will know how your distribution will name every block device you could connect to your machine.

Block devices naming conventions

IDE drives

  • IDE drives (using the old PATA driver) are prefixed with "hd"
    • the first device on the IDE controller (master) is hda
    • the second device (slave) is hdb

Since there can only be two drives on one IDE controller/cable, the master is the first one and the slave is the second one. Since most motherboard are fitted with two IDE controllers, it goes on the same way with the second controller:hdc being the master drive on the second controller and hdd the slave drive.

Be aware that, since Linux kernel 2.6.19, the support of IDE drives has been merged with SATA/SCSI drives and, therefore, will be named like them.

SATA and SCSI drives

This naming convention started with SCSI drives, and was extended to SATA drives with libATA. It applies to SCSI, SATA, PATA as well as others drives, out of the scope of OP question (USB mass storage, FireWire, etc.). Anyway, usually, all the devices using a serial bus use the same denomination nowadays (except for NVMe drive, but this would a story for PCI devices).

  • SATA/SCSI drives start with "sd"
    • the first one is sda
    • the second one is sdb
    • etc.

Partitions naming conventions

Regarding partitions, each of them is denoted by a number at the end of each disk, named as described previously, starting from 1. Except for some other devices not mentioned in OP, it is always the case.

By instance, for the partitions on a SATA drive, they would be listed as sda1, sda2, and so on, for primary partitions. Logical partitions start at the index "5", while the extended partition takes the index "4". Note that this is obviously only true for drives making use of MBR and not GPT.

Below, this is the output of lsblk giving an example for disk called sdd, with 3 primary partitions (sdd1,sdd2,sdd3), 1 extended partition (sdd4) and 2 logical partitions (sdd5,sdd6).

$ lsblk
sdd      8:48   1   1.9G  0 disk 
├─sdd1   8:49   1   153M  0 part 
├─sdd2   8:50   1   229M  0 part 
├─sdd3   8:51   1   138M  0 part 
├─sdd4   8:52   1     1K  0 part 
├─sdd5   8:53   1   289M  0 part 
└─sdd6   8:54   1   1.1G  0 part 

Master and slaves devices

A single IDE interface can support two devices. Usually, motherboards come with dual IDE interfaces (primary and secondary) for up to four IDE devices on a system.

To allow two drives to operate on the same parallel cable, IDE uses a special configuration called master and slave. This configuration allows one drive's controller to tell the other drive when it can transfer data to or from the computer. The name comes from the fact that the slave drive ask the master if it is communicating with the motherboard; if the master is, it will tell the slave to wait until the operation is finished but if not, it will tell the slave to go ahead.

The master/slave role could be chosen thanks to the "Cable Select" feature: you could use a jumper on each drive supporting this feature to select either "Master", "Slave" or "Auto" (this last option meaning that the master is at the end of the IDE cable and the slave is the other).

  • 2
    Happy to help! Hope I was clear enough. – Paradox Apr 6 at 11:19
  • 1
    Yep its pretty clear but one thing i gotta ask, do partitions ALWAYS start with 1 or 0? Also are master and slave devices only associated with IDE devices, or is there another interface such as PATA or SATA/SCSI which master and slave devices can exist on? – Qasim Apr 6 at 11:22
  • 1
    Always with 1 for drives. Only notable exceptions being floppy disks and CD/DVD devices where devices/partitions can be mixed up. – Paradox Apr 6 at 11:28
  • 1
    Also are master and slave devices only associated with IDE devices, or is there another interface such as PATA or SATA/SCSI which master and slave devices can exist on? – Qasim Apr 6 at 11:29
  • 1
    Master/slave pattern derives from the fact that it uses a parallel interface which ATA/ATAPI protcoles. Thereferore, it impacts all PATA connexions such as IDE, EIDE, Fast ATA, Fast IDE, Ultra ATA, etc. SATA making use of a single serial interface, there is no reason for this feature to exist for SATA. – Paradox Apr 6 at 11:36
2

Found an old reference which refers to everything but SATA.

SATA & SCSI drives are /dev/sdX where starts with a to refer to the physical drive.
Partitions are /dev/sdXY where Y represents the partition number (beginning with 1) within that device.

EIDE device naming was the same as IDE is the same as PATA, before Linux kernel 2.6.19 (Thank you, Paradox, for noting the change!)
/dev/hda was the 'master' drive on the 'primary' controller.
/dev/hdb was the 'slave' drive on the 'primary' controller.
/dev/hdc was the 'master' drive on the 'secondary' controller.
/dev/hdd was the 'slave' drive on the 'secondary' controller.
A number follows each drive device to denote the partition(s), beginning with 1.

Since Linux kernel 2.6.19, the same naming convention as SCSI & SATA is used for EIDE, IDE, and PATA.

  • 1
    SATA drives and USB thumb-drives are handled by the SCSI driver, so the reference still applies. The order (which disk sda) is derived from how the controller enumerates the disks (depending on the hardware, the order may change every boot). Hot-plugged devices usually are assigned the first unused letter (though you and the kernel may have different opinions on which letters are still in use). – Hermann Apr 5 at 19:02
  • 1
    The partitions do not start with "0" but "1" usually. – Paradox Apr 5 at 19:29

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.