Linux block devices naming The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsLinux kernel block device names (libATA)Linux Mint: drives' map changing at reboot brings fstab errorWhat driver is behind a certain device file?Why are there so many virtual terminal devices?How do i block USB devices based on device class in LinuxDebian - cannot find cdromDifference between sd0/sda, hd0/hdaWhy is the block size of a partition smaller than that of the underlying disk?Everything is file or process - LinuxUse /dev/ramX as their corresponding special devices?Safely remove USB device (of any type, not only block devices/mass storage)?

How to handle characters who are more educated than the author?

Does Parliament hold absolute power in the UK?

Word to describe a time interval

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Fixing different display colors within string

Huge performance difference of the command find with and without using %M option to show permissions

"... to apply for a visa" or "... and applied for a visa"?

Student Loan from years ago pops up and is taking my salary

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

Homework question about an engine pulling a train

Simulating Exploding Dice

Make it rain characters

Can the DM override racial traits?

What was the last x86 CPU that did not have the x87 floating-point unit built in?

Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

Is every episode of "Where are my Pants?" identical?

how can a perfect fourth interval be considered either consonant or dissonant?

Why can't devices on different VLANs, but on the same subnet, communicate?

Why are PDP-7-style microprogrammed instructions out of vogue?

Was credit for the black hole image misappropriated?

Circular reasoning in L'Hopital's rule

Why doesn't shell automatically fix "useless use of cat"?

Is there a writing software that you can sort scenes like slides in PowerPoint?



Linux block devices naming



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election ResultsLinux kernel block device names (libATA)Linux Mint: drives' map changing at reboot brings fstab errorWhat driver is behind a certain device file?Why are there so many virtual terminal devices?How do i block USB devices based on device class in LinuxDebian - cannot find cdromDifference between sd0/sda, hd0/hdaWhy is the block size of a partition smaller than that of the underlying disk?Everything is file or process - LinuxUse /dev/ramX as their corresponding special devices?Safely remove USB device (of any type, not only block devices/mass storage)?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








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?










share|improve this question



















  • 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

















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?










share|improve this question



















  • 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













0












0








0


2






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?










share|improve this question
















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?







linux devices disk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 6 at 16:15









Paradox

517318




517318










asked Apr 5 at 18:27









QasimQasim

3113




3113







  • 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












  • 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







2




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





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










2 Answers
2






active

oldest

votes


















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*", ENVID_SERIAL!="?*", SUBSYSTEMS=="scsi",
ATTRSvendor=="ATA", IMPORTprogram="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).






share|improve this answer




















  • 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.






share|improve this answer




















  • 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








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510778%2flinux-block-devices-naming%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









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*", ENVID_SERIAL!="?*", SUBSYSTEMS=="scsi",
ATTRSvendor=="ATA", IMPORTprogram="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).






share|improve this answer




















  • 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
















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*", ENVID_SERIAL!="?*", SUBSYSTEMS=="scsi",
ATTRSvendor=="ATA", IMPORTprogram="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).






share|improve this answer




















  • 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














8












8








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*", ENVID_SERIAL!="?*", SUBSYSTEMS=="scsi",
ATTRSvendor=="ATA", IMPORTprogram="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).






share|improve this answer















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*", ENVID_SERIAL!="?*", SUBSYSTEMS=="scsi",
ATTRSvendor=="ATA", IMPORTprogram="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).







share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday









Stephen Kitt

181k25414493




181k25414493










answered Apr 5 at 19:01









ParadoxParadox

517318




517318







  • 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





    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




2





Happy to help! Hope I was clear enough.

– Paradox
Apr 6 at 11:19





Happy to help! Hope I was clear enough.

– Paradox
Apr 6 at 11:19




1




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






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




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






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




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





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




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






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.






share|improve this answer




















  • 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
















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.






share|improve this answer




















  • 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














2












2








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.






share|improve this answer















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.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 8 at 15:52

























answered Apr 5 at 18:50









K7AAYK7AAY

1,1181028




1,1181028







  • 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













  • 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








1




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





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




1





The partitions do not start with "0" but "1" usually.

– Paradox
Apr 5 at 19:29






The partitions do not start with "0" but "1" usually.

– Paradox
Apr 5 at 19:29


















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510778%2flinux-block-devices-naming%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







-devices, disk, linux

Popular posts from this blog

Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

Frič See also Navigation menuinternal link

Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant