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;
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
add a comment |
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
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
add a comment |
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
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
linux devices disk
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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
- the first device on the IDE controller (master) is
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.
- the first one is
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
|
show 12 more comments
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 disksda
) 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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
- the first device on the IDE controller (master) is
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.
- the first one is
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
|
show 12 more comments
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
- the first device on the IDE controller (master) is
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.
- the first one is
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
|
show 12 more comments
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
- the first device on the IDE controller (master) is
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.
- the first one is
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).
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
- the first device on the IDE controller (master) is
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.
- the first one is
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).
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
|
show 12 more comments
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
|
show 12 more comments
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 disksda
) 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
add a comment |
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 disksda
) 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
add a comment |
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.
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.
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 disksda
) 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
add a comment |
1
SATA drives and USB thumb-drives are handled by the SCSI driver, so the reference still applies. The order (which disksda
) 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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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