What do device type numbers mean?
file /dev/* prints the description of a bunch of files as "block special (M/N)" and "character special (M/N)", where M and N are numbers. For example:
$ file /dev/null
/dev/null: character special (1/3)
man file doesn't seem to document these, but refers vaguely to man stat, which seems to refer to these as major and minor device types. apropos 'device type' finds nothing. So what do these numbers mean?
devices block-device character-special-files
add a comment |
file /dev/* prints the description of a bunch of files as "block special (M/N)" and "character special (M/N)", where M and N are numbers. For example:
$ file /dev/null
/dev/null: character special (1/3)
man file doesn't seem to document these, but refers vaguely to man stat, which seems to refer to these as major and minor device types. apropos 'device type' finds nothing. So what do these numbers mean?
devices block-device character-special-files
add a comment |
file /dev/* prints the description of a bunch of files as "block special (M/N)" and "character special (M/N)", where M and N are numbers. For example:
$ file /dev/null
/dev/null: character special (1/3)
man file doesn't seem to document these, but refers vaguely to man stat, which seems to refer to these as major and minor device types. apropos 'device type' finds nothing. So what do these numbers mean?
devices block-device character-special-files
file /dev/* prints the description of a bunch of files as "block special (M/N)" and "character special (M/N)", where M and N are numbers. For example:
$ file /dev/null
/dev/null: character special (1/3)
man file doesn't seem to document these, but refers vaguely to man stat, which seems to refer to these as major and minor device types. apropos 'device type' finds nothing. So what do these numbers mean?
devices block-device character-special-files
devices block-device character-special-files
asked Feb 6 at 0:19
l0b0l0b0
28.2k18119246
28.2k18119246
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Devices on Unix have a type (e.g. character or block), a major number (which typically refers to a driver), and a minor number (which typically refers to an instance).
So, for example:
% ls -l /dev/vda
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
This is a block device, major 253, minor 0.
If we look at /proc/devices we see it ends with something similar to
Block devices:
2 fd
259 blkext
9 md
253 virtblk
254 mdp
So we can see that 253 is "virtblk". Which makes sense, since this is a virtual machine with virtual disks!
The minor number, for this driver, refers to the block device and partition in the device
% ls -l /dev/vd*
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
brw-rw---- 1 root disk 253, 1 Feb 3 09:09 /dev/vda1
brw-rw---- 1 root disk 253, 2 Feb 3 09:09 /dev/vda2
brw-rw---- 1 root disk 253, 3 Feb 3 09:09 /dev/vda3
brw-rw---- 1 root disk 253, 16 Feb 3 09:09 /dev/vdb
brw-rw---- 1 root disk 253, 32 Feb 3 09:09 /dev/vdc
brw-rw---- 1 root disk 253, 33 Feb 3 09:09 /dev/vdc1
There are some special drivers which don't refer to "real" hardware. eg
% ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 /dev/null
This is a character device, major 1, minor 3. /proc/devices tells us driver 1
1 mem
We can see this "mem" driver handles a few other devices as well
% ls -l /dev | grep ' 1, '
crw-rw-rw- 1 root root 1, 7 Feb 3 09:09 full
crw-r--r-- 1 root root 1, 11 Feb 3 09:09 kmsg
crw-r----- 1 root kmem 1, 1 Feb 3 09:09 mem
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 null
crw------- 1 root root 1, 12 Feb 3 09:09 oldmem
crw-r----- 1 root kmem 1, 4 Feb 3 09:09 port
crw-rw-rw- 1 root root 1, 8 Feb 3 09:09 random
crw-rw-rw- 1 root root 1, 9 Feb 3 09:09 urandom
crw-rw-rw- 1 root root 1, 5 Feb 3 09:09 zero
That gives me a nice short name and index. Do you know what those short names mean? Some of them are pretty obvious, but I have no idea what "ttyS", "vcs", "sg", and many of the others mean in this context.
– l0b0
Feb 6 at 3:06
1
The names are picked by the drivers. Many of them have manpages; egman vcs. Others don't.ttySis serial;vcsisvirtual console memory;sgis raw scsi (I think).
– Stephen Harris
Feb 6 at 3:08
@StephenKitt That would work very well as an answer.
– l0b0
Feb 6 at 7:08
add a comment |
Each device node’s type (block or character) and numbers (known as the major and minor number) serve as identifiers for the kernel.
On Linux, the canonical list of devices, with a brief explanation of their function, is maintained in the kernel. You can see there that a major number typically identifies a driver (e.g. the TTY device driver) and a minor number identifies a device managed by that driver.
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%2f498932%2fwhat-do-device-type-numbers-mean%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
Devices on Unix have a type (e.g. character or block), a major number (which typically refers to a driver), and a minor number (which typically refers to an instance).
So, for example:
% ls -l /dev/vda
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
This is a block device, major 253, minor 0.
If we look at /proc/devices we see it ends with something similar to
Block devices:
2 fd
259 blkext
9 md
253 virtblk
254 mdp
So we can see that 253 is "virtblk". Which makes sense, since this is a virtual machine with virtual disks!
The minor number, for this driver, refers to the block device and partition in the device
% ls -l /dev/vd*
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
brw-rw---- 1 root disk 253, 1 Feb 3 09:09 /dev/vda1
brw-rw---- 1 root disk 253, 2 Feb 3 09:09 /dev/vda2
brw-rw---- 1 root disk 253, 3 Feb 3 09:09 /dev/vda3
brw-rw---- 1 root disk 253, 16 Feb 3 09:09 /dev/vdb
brw-rw---- 1 root disk 253, 32 Feb 3 09:09 /dev/vdc
brw-rw---- 1 root disk 253, 33 Feb 3 09:09 /dev/vdc1
There are some special drivers which don't refer to "real" hardware. eg
% ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 /dev/null
This is a character device, major 1, minor 3. /proc/devices tells us driver 1
1 mem
We can see this "mem" driver handles a few other devices as well
% ls -l /dev | grep ' 1, '
crw-rw-rw- 1 root root 1, 7 Feb 3 09:09 full
crw-r--r-- 1 root root 1, 11 Feb 3 09:09 kmsg
crw-r----- 1 root kmem 1, 1 Feb 3 09:09 mem
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 null
crw------- 1 root root 1, 12 Feb 3 09:09 oldmem
crw-r----- 1 root kmem 1, 4 Feb 3 09:09 port
crw-rw-rw- 1 root root 1, 8 Feb 3 09:09 random
crw-rw-rw- 1 root root 1, 9 Feb 3 09:09 urandom
crw-rw-rw- 1 root root 1, 5 Feb 3 09:09 zero
That gives me a nice short name and index. Do you know what those short names mean? Some of them are pretty obvious, but I have no idea what "ttyS", "vcs", "sg", and many of the others mean in this context.
– l0b0
Feb 6 at 3:06
1
The names are picked by the drivers. Many of them have manpages; egman vcs. Others don't.ttySis serial;vcsisvirtual console memory;sgis raw scsi (I think).
– Stephen Harris
Feb 6 at 3:08
@StephenKitt That would work very well as an answer.
– l0b0
Feb 6 at 7:08
add a comment |
Devices on Unix have a type (e.g. character or block), a major number (which typically refers to a driver), and a minor number (which typically refers to an instance).
So, for example:
% ls -l /dev/vda
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
This is a block device, major 253, minor 0.
If we look at /proc/devices we see it ends with something similar to
Block devices:
2 fd
259 blkext
9 md
253 virtblk
254 mdp
So we can see that 253 is "virtblk". Which makes sense, since this is a virtual machine with virtual disks!
The minor number, for this driver, refers to the block device and partition in the device
% ls -l /dev/vd*
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
brw-rw---- 1 root disk 253, 1 Feb 3 09:09 /dev/vda1
brw-rw---- 1 root disk 253, 2 Feb 3 09:09 /dev/vda2
brw-rw---- 1 root disk 253, 3 Feb 3 09:09 /dev/vda3
brw-rw---- 1 root disk 253, 16 Feb 3 09:09 /dev/vdb
brw-rw---- 1 root disk 253, 32 Feb 3 09:09 /dev/vdc
brw-rw---- 1 root disk 253, 33 Feb 3 09:09 /dev/vdc1
There are some special drivers which don't refer to "real" hardware. eg
% ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 /dev/null
This is a character device, major 1, minor 3. /proc/devices tells us driver 1
1 mem
We can see this "mem" driver handles a few other devices as well
% ls -l /dev | grep ' 1, '
crw-rw-rw- 1 root root 1, 7 Feb 3 09:09 full
crw-r--r-- 1 root root 1, 11 Feb 3 09:09 kmsg
crw-r----- 1 root kmem 1, 1 Feb 3 09:09 mem
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 null
crw------- 1 root root 1, 12 Feb 3 09:09 oldmem
crw-r----- 1 root kmem 1, 4 Feb 3 09:09 port
crw-rw-rw- 1 root root 1, 8 Feb 3 09:09 random
crw-rw-rw- 1 root root 1, 9 Feb 3 09:09 urandom
crw-rw-rw- 1 root root 1, 5 Feb 3 09:09 zero
That gives me a nice short name and index. Do you know what those short names mean? Some of them are pretty obvious, but I have no idea what "ttyS", "vcs", "sg", and many of the others mean in this context.
– l0b0
Feb 6 at 3:06
1
The names are picked by the drivers. Many of them have manpages; egman vcs. Others don't.ttySis serial;vcsisvirtual console memory;sgis raw scsi (I think).
– Stephen Harris
Feb 6 at 3:08
@StephenKitt That would work very well as an answer.
– l0b0
Feb 6 at 7:08
add a comment |
Devices on Unix have a type (e.g. character or block), a major number (which typically refers to a driver), and a minor number (which typically refers to an instance).
So, for example:
% ls -l /dev/vda
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
This is a block device, major 253, minor 0.
If we look at /proc/devices we see it ends with something similar to
Block devices:
2 fd
259 blkext
9 md
253 virtblk
254 mdp
So we can see that 253 is "virtblk". Which makes sense, since this is a virtual machine with virtual disks!
The minor number, for this driver, refers to the block device and partition in the device
% ls -l /dev/vd*
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
brw-rw---- 1 root disk 253, 1 Feb 3 09:09 /dev/vda1
brw-rw---- 1 root disk 253, 2 Feb 3 09:09 /dev/vda2
brw-rw---- 1 root disk 253, 3 Feb 3 09:09 /dev/vda3
brw-rw---- 1 root disk 253, 16 Feb 3 09:09 /dev/vdb
brw-rw---- 1 root disk 253, 32 Feb 3 09:09 /dev/vdc
brw-rw---- 1 root disk 253, 33 Feb 3 09:09 /dev/vdc1
There are some special drivers which don't refer to "real" hardware. eg
% ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 /dev/null
This is a character device, major 1, minor 3. /proc/devices tells us driver 1
1 mem
We can see this "mem" driver handles a few other devices as well
% ls -l /dev | grep ' 1, '
crw-rw-rw- 1 root root 1, 7 Feb 3 09:09 full
crw-r--r-- 1 root root 1, 11 Feb 3 09:09 kmsg
crw-r----- 1 root kmem 1, 1 Feb 3 09:09 mem
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 null
crw------- 1 root root 1, 12 Feb 3 09:09 oldmem
crw-r----- 1 root kmem 1, 4 Feb 3 09:09 port
crw-rw-rw- 1 root root 1, 8 Feb 3 09:09 random
crw-rw-rw- 1 root root 1, 9 Feb 3 09:09 urandom
crw-rw-rw- 1 root root 1, 5 Feb 3 09:09 zero
Devices on Unix have a type (e.g. character or block), a major number (which typically refers to a driver), and a minor number (which typically refers to an instance).
So, for example:
% ls -l /dev/vda
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
This is a block device, major 253, minor 0.
If we look at /proc/devices we see it ends with something similar to
Block devices:
2 fd
259 blkext
9 md
253 virtblk
254 mdp
So we can see that 253 is "virtblk". Which makes sense, since this is a virtual machine with virtual disks!
The minor number, for this driver, refers to the block device and partition in the device
% ls -l /dev/vd*
brw-rw---- 1 root disk 253, 0 Feb 3 09:09 /dev/vda
brw-rw---- 1 root disk 253, 1 Feb 3 09:09 /dev/vda1
brw-rw---- 1 root disk 253, 2 Feb 3 09:09 /dev/vda2
brw-rw---- 1 root disk 253, 3 Feb 3 09:09 /dev/vda3
brw-rw---- 1 root disk 253, 16 Feb 3 09:09 /dev/vdb
brw-rw---- 1 root disk 253, 32 Feb 3 09:09 /dev/vdc
brw-rw---- 1 root disk 253, 33 Feb 3 09:09 /dev/vdc1
There are some special drivers which don't refer to "real" hardware. eg
% ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 /dev/null
This is a character device, major 1, minor 3. /proc/devices tells us driver 1
1 mem
We can see this "mem" driver handles a few other devices as well
% ls -l /dev | grep ' 1, '
crw-rw-rw- 1 root root 1, 7 Feb 3 09:09 full
crw-r--r-- 1 root root 1, 11 Feb 3 09:09 kmsg
crw-r----- 1 root kmem 1, 1 Feb 3 09:09 mem
crw-rw-rw- 1 root root 1, 3 Feb 3 09:09 null
crw------- 1 root root 1, 12 Feb 3 09:09 oldmem
crw-r----- 1 root kmem 1, 4 Feb 3 09:09 port
crw-rw-rw- 1 root root 1, 8 Feb 3 09:09 random
crw-rw-rw- 1 root root 1, 9 Feb 3 09:09 urandom
crw-rw-rw- 1 root root 1, 5 Feb 3 09:09 zero
answered Feb 6 at 0:41
Stephen HarrisStephen Harris
26.2k24678
26.2k24678
That gives me a nice short name and index. Do you know what those short names mean? Some of them are pretty obvious, but I have no idea what "ttyS", "vcs", "sg", and many of the others mean in this context.
– l0b0
Feb 6 at 3:06
1
The names are picked by the drivers. Many of them have manpages; egman vcs. Others don't.ttySis serial;vcsisvirtual console memory;sgis raw scsi (I think).
– Stephen Harris
Feb 6 at 3:08
@StephenKitt That would work very well as an answer.
– l0b0
Feb 6 at 7:08
add a comment |
That gives me a nice short name and index. Do you know what those short names mean? Some of them are pretty obvious, but I have no idea what "ttyS", "vcs", "sg", and many of the others mean in this context.
– l0b0
Feb 6 at 3:06
1
The names are picked by the drivers. Many of them have manpages; egman vcs. Others don't.ttySis serial;vcsisvirtual console memory;sgis raw scsi (I think).
– Stephen Harris
Feb 6 at 3:08
@StephenKitt That would work very well as an answer.
– l0b0
Feb 6 at 7:08
That gives me a nice short name and index. Do you know what those short names mean? Some of them are pretty obvious, but I have no idea what "ttyS", "vcs", "sg", and many of the others mean in this context.
– l0b0
Feb 6 at 3:06
That gives me a nice short name and index. Do you know what those short names mean? Some of them are pretty obvious, but I have no idea what "ttyS", "vcs", "sg", and many of the others mean in this context.
– l0b0
Feb 6 at 3:06
1
1
The names are picked by the drivers. Many of them have manpages; eg
man vcs. Others don't. ttyS is serial; vcs is virtual console memory; sg is raw scsi (I think).– Stephen Harris
Feb 6 at 3:08
The names are picked by the drivers. Many of them have manpages; eg
man vcs. Others don't. ttyS is serial; vcs is virtual console memory; sg is raw scsi (I think).– Stephen Harris
Feb 6 at 3:08
@StephenKitt That would work very well as an answer.
– l0b0
Feb 6 at 7:08
@StephenKitt That would work very well as an answer.
– l0b0
Feb 6 at 7:08
add a comment |
Each device node’s type (block or character) and numbers (known as the major and minor number) serve as identifiers for the kernel.
On Linux, the canonical list of devices, with a brief explanation of their function, is maintained in the kernel. You can see there that a major number typically identifies a driver (e.g. the TTY device driver) and a minor number identifies a device managed by that driver.
add a comment |
Each device node’s type (block or character) and numbers (known as the major and minor number) serve as identifiers for the kernel.
On Linux, the canonical list of devices, with a brief explanation of their function, is maintained in the kernel. You can see there that a major number typically identifies a driver (e.g. the TTY device driver) and a minor number identifies a device managed by that driver.
add a comment |
Each device node’s type (block or character) and numbers (known as the major and minor number) serve as identifiers for the kernel.
On Linux, the canonical list of devices, with a brief explanation of their function, is maintained in the kernel. You can see there that a major number typically identifies a driver (e.g. the TTY device driver) and a minor number identifies a device managed by that driver.
Each device node’s type (block or character) and numbers (known as the major and minor number) serve as identifiers for the kernel.
On Linux, the canonical list of devices, with a brief explanation of their function, is maintained in the kernel. You can see there that a major number typically identifies a driver (e.g. the TTY device driver) and a minor number identifies a device managed by that driver.
answered Feb 6 at 7:20
Stephen KittStephen Kitt
172k24386465
172k24386465
add a comment |
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%2f498932%2fwhat-do-device-type-numbers-mean%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