← Documents Documentation/admin-guide/devices.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Device Registry

Linux allocated devices (4.x+ version)

Linux device-number registry의 갱신 정책, `/dev` link와 mount point, console·serial·PTY naming 및 lock 규칙을 설명합니다.

Source pathDocumentation/admin-guide/devices.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

Registry policy

devices.rst:1-61

Mainline master registry의 patch 절차, dynamic allocation 우선 원칙과 namespace review를 설명합니다.

Terminal naming

devices.rst:158-268

Virtual console, serial primary·alternate device, lock order와 legacy·Unix98 PTY naming을 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. _admin_devices:
2
3 Linux allocated devices (4.x+ version)
4 ======================================
5
6 This list is the Linux Device List, the official registry of allocated
7 device numbers and ``/dev`` directory nodes for the Linux operating
8 system.
9
10 The version of this document at lanana.org is no longer maintained. This
11 version in the mainline Linux kernel is the master document. Updates
12 shall be sent as patches to the kernel maintainers (see the
13 :ref:`Documentation/process/submitting-patches.rst <submittingpatches>` document).
14 Specifically explore the sections titled "CHAR and MISC DRIVERS", and
15 "BLOCK LAYER" in the MAINTAINERS file to find the right maintainers
16 to involve for character and block devices.
17
18 This document is included by reference into the Filesystem Hierarchy
19 Standard (FHS). The FHS is available from https://www.pathname.com/fhs/.
20
21 Allocations marked (68k/Amiga) apply to Linux/68k on the Amiga
22 platform only. Allocations marked (68k/Atari) apply to Linux/68k on
23 the Atari platform only.
24
25 This document is in the public domain. The authors requests, however,
26 that semantically altered versions are not distributed without
27 permission of the authors, assuming the authors can be contacted without
28 an unreasonable effort.
29
30
31 .. attention::
32
33 DEVICE DRIVERS AUTHORS PLEASE READ THIS
34
35 Linux now has extensive support for dynamic allocation of device numbering
36 and can use ``sysfs`` and ``udev`` (``systemd``) to handle the naming needs.
37 There are still some exceptions in the serial and boot device area. Before
38 asking for a device number make sure you actually need one.
39
40 To have a major number allocated, or a minor number in situations
41 where that applies (e.g. busmice), please submit a patch and send to
42 the authors as indicated above.
43
44 Keep the description of the device *in the same format
45 as this list*. The reason for this is that it is the only way we have
46 found to ensure we have all the requisite information to publish your
47 device and avoid conflicts.
48
49 Finally, sometimes we have to play "namespace police." Please don't be
50 offended. We often get submissions for ``/dev`` names that would be bound
51 to cause conflicts down the road. We are trying to avoid getting in a
52 situation where we would have to suffer an incompatible forward
53 change. Therefore, please consult with us **before** you make your
54 device names and numbers in any way public, at least to the point
55 where it would be at all difficult to get them changed.
56
57 Your cooperation is appreciated.
58
59 .. include:: devices.txt
60 :literal:
61
62 Additional ``/dev/`` directory entries
63 --------------------------------------
64
65 This section details additional entries that should or may exist in
66 the /dev directory. It is preferred that symbolic links use the same
67 form (absolute or relative) as is indicated here. Links are
68 classified as "hard" or "symbolic" depending on the preferred type of
69 link; if possible, the indicated type of link should be used.
70
71 Compulsory links
72 ++++++++++++++++
73
74 These links should exist on all systems:
75
76 =============== =============== =============== ===============================
77 /dev/fd /proc/self/fd symbolic File descriptors
78 /dev/stdin fd/0 symbolic stdin file descriptor
79 /dev/stdout fd/1 symbolic stdout file descriptor
80 /dev/stderr fd/2 symbolic stderr file descriptor
81 /dev/nfsd socksys symbolic Required by iBCS-2
82 /dev/X0R null symbolic Required by iBCS-2
83 =============== =============== =============== ===============================
84
85 Note: ``/dev/X0R`` is <letter X>-<digit 0>-<letter R>.
86
87 Recommended links
88 +++++++++++++++++
89
90 It is recommended that these links exist on all systems:
91
92
93 =============== =============== =============== ===============================
94 /dev/core /proc/kcore symbolic Backward compatibility
95 /dev/ramdisk ram0 symbolic Backward compatibility
96 /dev/ftape qft0 symbolic Backward compatibility
97 /dev/bttv0 video0 symbolic Backward compatibility
98 /dev/radio radio0 symbolic Backward compatibility
99 /dev/i2o* /dev/i2o/* symbolic Backward compatibility
100 /dev/scd? sr? hard Alternate SCSI CD-ROM name
101 =============== =============== =============== ===============================
102
103 Locally defined links
104 +++++++++++++++++++++
105
106 The following links may be established locally to conform to the
107 configuration of the system. This is merely a tabulation of existing
108 practice, and does not constitute a recommendation. However, if they
109 exist, they should have the following uses.
110
111 =============== =============== =============== ===============================
112 /dev/mouse mouse port symbolic Current mouse device
113 /dev/tape tape device symbolic Current tape device
114 /dev/cdrom CD-ROM device symbolic Current CD-ROM device
115 /dev/cdwriter CD-writer symbolic Current CD-writer device
116 /dev/scanner scanner symbolic Current scanner device
117 /dev/modem modem port symbolic Current dialout device
118 /dev/root root device symbolic Current root filesystem
119 /dev/swap swap device symbolic Current swap device
120 =============== =============== =============== ===============================
121
122 ``/dev/modem`` should not be used for a modem which supports dialin as
123 well as dialout, as it tends to cause lock file problems. If it
124 exists, ``/dev/modem`` should point to the appropriate primary TTY device
125 (the use of the alternate callout devices is deprecated).
126
127 For SCSI devices, ``/dev/tape`` and ``/dev/cdrom`` should point to the
128 *cooked* devices (``/dev/st*`` and ``/dev/sr*``, respectively), whereas
129 ``/dev/cdwriter`` and /dev/scanner should point to the appropriate generic
130 SCSI devices (/dev/sg*).
131
132 ``/dev/mouse`` may point to a primary serial TTY device, a hardware mouse
133 device, or a socket for a mouse driver program (e.g. ``/dev/gpmdata``).
134
135 Sockets and pipes
136 +++++++++++++++++
137
138 Non-transient sockets and named pipes may exist in /dev. Common entries are:
139
140 =============== =============== ===============================================
141 /dev/printer socket lpd local socket
142 /dev/log socket syslog local socket
143 /dev/gpmdata socket gpm mouse multiplexer
144 =============== =============== ===============================================
145
146 Mount points
147 ++++++++++++
148
149 The following names are reserved for mounting special filesystems
150 under /dev. These special filesystems provide kernel interfaces that
151 cannot be provided with standard device nodes.
152
153 =============== =============== ===============================================
154 /dev/pts devpts PTY slave filesystem
155 /dev/shm tmpfs POSIX shared memory maintenance access
156 =============== =============== ===============================================
157
158 Terminal devices
159 ----------------
160
161 Terminal, or TTY devices are a special class of character devices. A
162 terminal device is any device that could act as a controlling terminal
163 for a session; this includes virtual consoles, serial ports, and
164 pseudoterminals (PTYs).
165
166 All terminal devices share a common set of capabilities known as line
167 disciplines; these include the common terminal line discipline as well
168 as SLIP and PPP modes.
169
170 All terminal devices are named similarly; this section explains the
171 naming and use of the various types of TTYs. Note that the naming
172 conventions include several historical warts; some of these are
173 Linux-specific, some were inherited from other systems, and some
174 reflect Linux outgrowing a borrowed convention.
175
176 A hash mark (``#``) in a device name is used here to indicate a decimal
177 number without leading zeroes.
178
179 Virtual consoles and the console device
180 +++++++++++++++++++++++++++++++++++++++
181
182 Virtual consoles are full-screen terminal displays on the system video
183 monitor. Virtual consoles are named ``/dev/tty#``, with numbering
184 starting at ``/dev/tty1``; ``/dev/tty0`` is the current virtual console.
185 ``/dev/tty0`` is the device that should be used to access the system video
186 card on those architectures for which the frame buffer devices
187 (``/dev/fb*``) are not applicable. Do not use ``/dev/console``
188 for this purpose.
189
190 The console device, ``/dev/console``, is the device to which system
191 messages should be sent, and on which logins should be permitted in
192 single-user mode. Starting with Linux 2.1.71, ``/dev/console`` is managed
193 by the kernel; for previous versions it should be a symbolic link to
194 either ``/dev/tty0``, a specific virtual console such as ``/dev/tty1``, or to
195 a serial port primary (``tty*``, not ``cu*``) device, depending on the
196 configuration of the system.
197
198 Serial ports
199 ++++++++++++
200
201 Serial ports are RS-232 serial ports and any device which simulates
202 one, either in hardware (such as internal modems) or in software (such
203 as the ISDN driver.) Under Linux, each serial ports has two device
204 names, the primary or callin device and the alternate or callout one.
205 Each kind of device is indicated by a different letter. For any
206 letter X, the names of the devices are ``/dev/ttyX#`` and ``/dev/cux#``,
207 respectively; for historical reasons, ``/dev/ttyS#`` and ``/dev/ttyC#``
208 correspond to ``/dev/cua#`` and ``/dev/cub#``. In the future, it should be
209 expected that multiple letters will be used; all letters will be upper
210 case for the "tty" device (e.g. ``/dev/ttyDP#``) and lower case for the
211 "cu" device (e.g. ``/dev/cudp#``).
212
213 The names ``/dev/ttyQ#`` and ``/dev/cuq#`` are reserved for local use.
214
215 The alternate devices provide for kernel-based exclusion and somewhat
216 different defaults than the primary devices. Their main purpose is to
217 allow the use of serial ports with programs with no inherent or broken
218 support for serial ports. Their use is deprecated, and they may be
219 removed from a future version of Linux.
220
221 Arbitration of serial ports is provided by the use of lock files with
222 the names ``/var/lock/LCK..ttyX#``. The contents of the lock file should
223 be the PID of the locking process as an ASCII number.
224
225 It is common practice to install links such as /dev/modem
226 which point to serial ports. In order to ensure proper locking in the
227 presence of these links, it is recommended that software chase
228 symlinks and lock all possible names; additionally, it is recommended
229 that a lock file be installed with the corresponding alternate
230 device. In order to avoid deadlocks, it is recommended that the locks
231 are acquired in the following order, and released in the reverse:
232
233 1. The symbolic link name, if any (``/var/lock/LCK..modem``)
234 2. The "tty" name (``/var/lock/LCK..ttyS2``)
235 3. The alternate device name (``/var/lock/LCK..cua2``)
236
237 In the case of nested symbolic links, the lock files should be
238 installed in the order the symlinks are resolved.
239
240 Under no circumstances should an application hold a lock while waiting
241 for another to be released. In addition, applications which attempt
242 to create lock files for the corresponding alternate device names
243 should take into account the possibility of being used on a non-serial
244 port TTY, for which no alternate device would exist.
245
246 Pseudoterminals (PTYs)
247 ++++++++++++++++++++++
248
249 Pseudoterminals, or PTYs, are used to create login sessions or provide
250 other capabilities requiring a TTY line discipline (including SLIP or
251 PPP capability) to arbitrary data-generation processes. Each PTY has
252 a master side, named ``/dev/pty[p-za-e][0-9a-f]``, and a slave side, named
253 ``/dev/tty[p-za-e][0-9a-f]``. The kernel arbitrates the use of PTYs by
254 allowing each master side to be opened only once.
255
256 Once the master side has been opened, the corresponding slave device
257 can be used in the same manner as any TTY device. The master and
258 slave devices are connected by the kernel, generating the equivalent
259 of a bidirectional pipe with TTY capabilities.
260
261 Recent versions of the Linux kernels and GNU libc contain support for
262 the System V/Unix98 naming scheme for PTYs, which assigns a common
263 device, ``/dev/ptmx``, to all the masters (opening it will automatically
264 give you a previously unassigned PTY) and a subdirectory, ``/dev/pts``,
265 for the slaves; the slaves are named with decimal integers (``/dev/pts/#``
266 in our notation). This removes the problem of exhausting the
267 namespace and enables the kernel to automatically create the device
268 nodes for the slaves on demand using the "devpts" filesystem.
269

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Linux allocated device registry

1-30

이 목록은 Linux operating system에 할당된 device number와 `/dev` directory node의 공식 registry인 Linux Device List입니다.

`lanana.org`에 있던 문서 version은 더 이상 유지되지 않습니다. Mainline Linux kernel의 이 version이 master document입니다. Update는 `Documentation/process/submitting-patches.rst`의 안내에 따라 kernel maintainer에게 patch로 보내야 합니다.

Character device와 block device에 관여해야 할 올바른 maintainer를 찾으려면 `MAINTAINERS` file에서 `CHAR and MISC DRIVERS`, `BLOCK LAYER` section을 구체적으로 살펴보십시오.

이 문서는 Filesystem Hierarchy Standard(FHS)에 reference로 포함됩니다. FHS는 `https://www.pathname.com/fhs/`에서 볼 수 있습니다.

`(68k/Amiga)` 표시 allocation은 Amiga platform의 Linux/68k에만 적용되고 `(68k/Atari)` 표시는 Atari platform의 Linux/68k에만 적용됩니다.

이 문서는 public domain입니다. 다만 합리적인 노력으로 저자에게 연락할 수 있다면 의미를 변경한 version을 저자 허락 없이 배포하지 말아 달라고 요청합니다.

Device-number update 경로
새 character·block allocation 필요`MAINTAINERS`에서 담당자 확인Registry 형식으로 kernel patch 작성Maintainer reviewMainline master document 갱신

Mainline 문서가 authoritative registry이며 변경은 maintainer review를 거칩니다.

Driver author를 위한 allocation 지침

31-61

Device driver 저자는 이 내용을 반드시 읽어야 합니다. Linux는 device numbering의 dynamic allocation을 폭넓게 지원하며 `sysfs`와 `udev`(`systemd`)로 naming 요구를 처리할 수 있습니다. Serial과 boot device 영역에는 아직 예외가 있지만 device number를 요청하기 전에 실제로 필요한지 확인하십시오.

Major number 또는 bus mouse처럼 필요한 상황의 minor number를 할당받으려면 앞서 안내한 저자에게 patch를 제출하십시오.

Device description은 이 목록과 같은 format으로 유지해야 합니다. 필요한 정보를 빠짐없이 publication하고 conflict를 피할 수 있다고 확인된 유일한 방법이기 때문입니다.

때로는 namespace conflict를 막기 위해 이름을 조정해야 합니다. 장래 conflict를 일으킬 `/dev` name 제안이 자주 들어오며, 이후 incompatible change가 필요한 상황을 피하려는 것입니다. Device name과 number를 변경하기 어려울 정도로 공개하기 전에 반드시 registry maintainer와 상의하십시오.

협조에 감사드립니다. 실제 allocated device number 목록은 `devices.txt`를 literal include합니다.

정적 device number 요청 전 점검
점검요구사항
Dynamic allocation먼저 sysfs·udev(systemd) 사용 가능성 확인
MaintainerCHAR and MISC DRIVERS 또는 BLOCK LAYER 확인
Submission동일한 registry format의 patch
NamespaceName·number 공개 전에 conflict 검토
Registry body`devices.txt` literal include

Dynamic allocation과 userspace naming으로 해결할 수 없는 경우에만 registry allocation을 요청합니다.

Sockets, pipes와 mount point

135-157

Transient하지 않은 socket과 named pipe는 `/dev`에 존재할 수 있습니다. 흔한 entry는 다음과 같습니다.

Sockets and pipes
PathType용도
`/dev/printer`Socketlpd local socket
`/dev/log`Socketsyslog local socket
`/dev/gpmdata`Socketgpm mouse multiplexer

Local service endpoint로 사용되는 conventional `/dev` socket입니다.

다음 name은 `/dev` 아래에 special filesystem을 mount하기 위해 예약됩니다. 이 filesystem은 표준 device node로 제공할 수 없는 kernel interface를 제공합니다.

Reserved mount points
PathFilesystem용도
`/dev/pts``devpts`PTY slave filesystem
`/dev/shm``tmpfs`POSIX shared memory maintenance access

`/dev` 아래의 kernel-interface filesystem mount입니다.

Terminal device와 line discipline

158-178

Terminal 또는 TTY device는 character device의 특수 class입니다. Session의 controlling terminal 역할을 할 수 있는 모든 device가 terminal이며 virtual console, serial port, pseudoterminal(PTY)을 포함합니다.

모든 terminal device는 line discipline이라는 공통 capability set을 공유합니다. 일반 terminal line discipline과 SLIP·PPP mode가 여기에 포함됩니다.

모든 terminal device는 비슷하게 naming됩니다. 이 section은 여러 TTY type의 naming과 사용법을 설명합니다. Convention에는 역사적인 불규칙성이 있으며 일부는 Linux 고유, 일부는 다른 system에서 물려받은 것, 일부는 Linux가 빌린 convention의 범위를 넘어 성장한 결과입니다.

Device name의 hash mark `#`는 leading zero가 없는 decimal number를 뜻합니다.

TTY class
분류
Terminal deviceVirtual console, serial port, PTY
Line disciplineCommon terminal, SLIP, PPP
Name placeholder `#`Leading zero 없는 decimal number

Controlling terminal이 될 수 있는 device와 공통 line discipline입니다.

Virtual console과 `/dev/console`

179-197

Virtual console은 system video monitor의 full-screen terminal display입니다. 이름은 `/dev/tty#`이며 `/dev/tty1`부터 numbering합니다. `/dev/tty0`은 현재 virtual console입니다.

Framebuffer device `/dev/fb*`를 적용할 수 없는 architecture에서 system video card에 접근할 때는 `/dev/tty0`을 사용해야 합니다. 이 목적으로 `/dev/console`을 사용하지 마십시오.

`/dev/console`은 system message를 보낼 device이며 single-user mode에서 login을 허용할 device입니다. Linux 2.1.71부터 kernel이 관리합니다. 이전 version에서는 system configuration에 따라 `/dev/tty0`, `/dev/tty1` 같은 특정 virtual console 또는 serial port primary device인 `tty*`(not `cu*`)로 가는 symbolic link여야 합니다.

Console device 구분
Path역할
`/dev/tty1` ...번호가 지정된 virtual console
`/dev/tty0`현재 virtual console·system video card 접근
`/dev/console`System message와 single-user login
`/dev/fb*`Framebuffer 적용 architecture의 video interface

현재 화면 접근과 system console의 역할은 서로 다릅니다.

Serial port primary·alternate naming

198-220

Serial port는 RS-232 port와 internal modem 같은 hardware 또는 ISDN driver 같은 software로 이를 흉내 내는 device를 포함합니다. Linux에서 각 serial port에는 primary/callin과 alternate/callout 두 device name이 있습니다.

각 kind는 다른 letter로 표시합니다. Letter X에 대해 이름은 각각 `/dev/ttyX#`, `/dev/cux#`입니다. 역사적 이유로 `/dev/ttyS#`, `/dev/ttyC#`는 각각 `/dev/cua#`, `/dev/cub#`에 대응합니다.

앞으로 여러 letter를 사용할 수 있습니다. `tty` device에는 모두 uppercase(`/dev/ttyDP#`), `cu` device에는 lowercase(`/dev/cudp#`)를 사용합니다. `/dev/ttyQ#`, `/dev/cuq#`는 local use로 예약되어 있습니다.

Alternate device는 kernel-based exclusion과 primary device와 조금 다른 default를 제공합니다. Serial port 지원이 없거나 잘못된 program이 serial port를 사용할 수 있게 하는 것이 주목적입니다. 이 사용법은 deprecated이며 향후 Linux version에서 제거될 수 있습니다.

Serial device naming
Primary/callinAlternate/callout비고
`/dev/ttyX#``/dev/cux#`일반 pattern
`/dev/ttyS#``/dev/cua#`Historical mapping
`/dev/ttyC#``/dev/cub#`Historical mapping
`/dev/ttyDP#``/dev/cudp#`Multi-letter case convention
`/dev/ttyQ#``/dev/cuq#`Local use reserved

Primary tty name과 alternate cu name의 대응 관계입니다.

Serial lock file 순서

221-245

Serial port arbitration은 `/var/lock/LCK..ttyX#` 형태의 lock file로 제공합니다. Lock file 내용은 lock을 보유한 process PID를 ASCII number로 기록해야 합니다.

Serial port를 가리키는 `/dev/modem` 같은 link를 설치하는 관행이 흔합니다. 이런 link가 있어도 올바르게 locking하려면 software가 symlink를 따라가 가능한 모든 name을 lock하는 것이 좋습니다. 대응 alternate device용 lock file도 설치하는 것이 좋습니다.

Deadlock을 피하려면 다음 순서로 lock을 획득하고 역순으로 해제하십시오. 1) 존재한다면 symbolic link name(`/var/lock/LCK..modem`), 2) `tty` name(`/var/lock/LCK..ttyS2`), 3) alternate device name(`/var/lock/LCK..cua2`).

Nested symbolic link라면 symlink가 resolve되는 순서로 lock file을 설치해야 합니다.

어떤 경우에도 application이 다른 lock 해제를 기다리면서 lock을 보유해서는 안 됩니다. 대응 alternate device name의 lock file을 만들려는 application은 alternate device가 없는 non-serial-port TTY에서 사용될 가능성도 고려해야 합니다.

Serial lock acquisition order
`LCK..modem` symbolic link`LCK..ttyS2` primary tty`LCK..cua2` alternate device작업 수행역순 release

모든 participant가 같은 순서를 사용하고 reverse order로 해제해 deadlock을 피합니다.

Legacy PTY와 Unix98 PTY

246-268

Pseudoterminal(PTY)은 login session을 만들거나 SLIP·PPP를 포함해 TTY line discipline이 필요한 capability를 임의 data-generation process에 제공하는 데 사용합니다.

각 legacy PTY에는 `/dev/pty[p-za-e][0-9a-f]` 형태의 master side와 `/dev/tty[p-za-e][0-9a-f]` 형태의 slave side가 있습니다. Kernel은 각 master side를 한 번만 open할 수 있게 하여 PTY 사용을 중재합니다.

Master side를 open하면 대응 slave device를 다른 TTY device와 같은 방식으로 사용할 수 있습니다. Kernel이 master와 slave를 연결하여 TTY capability가 있는 bidirectional pipe와 같은 기능을 만듭니다.

최근 Linux kernel과 GNU libc는 System V/Unix98 PTY naming scheme을 지원합니다. 모든 master가 공통 device `/dev/ptmx`를 사용하며 이를 open하면 아직 할당되지 않은 PTY를 자동으로 얻습니다. Slave는 `/dev/pts` subdirectory 아래 decimal integer name(`/dev/pts/#`)을 사용합니다.

이 방식은 namespace 고갈 문제를 없애고 kernel이 `devpts` filesystem을 사용해 필요한 slave device node를 on-demand로 자동 생성하게 합니다.

PTY naming model
ModelMasterSlaveAllocation
Legacy`/dev/pty[p-za-e][0-9a-f]``/dev/tty[p-za-e][0-9a-f]`고정 name, master 1회 open
System V/Unix98`/dev/ptmx``/dev/pts/#``devpts` on-demand

Legacy fixed namespace와 Unix98 dynamic allocation을 비교합니다.

Unix98 PTY creation
Open `/dev/ptmx`Unused PTY allocation`devpts`가 `/dev/pts/#` 생성Master·slave bidirectional TTY pipe

Common master를 열면 kernel이 PTY pair와 slave node를 동적으로 만듭니다.