File: dev-fs.html

package info (click to toggle)
sysadmin-guide 0.9-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, lenny, squeeze, wheezy
  • size: 944 kB
  • ctags: 1
  • sloc: makefile: 5
file content (668 lines) | stat: -rw-r--r-- 14,219 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>The /dev directory</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Linux System Administrators Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="Overview of the Directory Tree"
HREF="dir-tree-overview.html"><LINK
REL="PREVIOUS"
TITLE="The /etc directory"
HREF="etc-fs.html"><LINK
REL="NEXT"
TITLE="The /usr filesystem."
HREF="usr-fs.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux System Administrators Guide: </TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="etc-fs.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 3. Overview of the Directory Tree</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="usr-fs.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="DEV-FS"
></A
>3.4. The <TT
CLASS="FILENAME"
>/dev</TT
> directory</H1
><P
>The <TT
CLASS="FILENAME"
>/dev</TT
> directory contains
	the special device files for all the devices. 
	The device files are created during
	installation, and later with the <B
CLASS="COMMAND"
>/dev/MAKEDEV</B
>
	script. The <B
CLASS="COMMAND"
>/dev/MAKEDEV.local</B
> is a script
	written by the system administrator that creates local-only device
	files or links (i.e. those that are not part of the standard
	<B
CLASS="COMMAND"
>MAKEDEV</B
>, such as device files for some
	non-standard device driver).</P
><P
>This list which follows is by no means exhaustive or as
        detailed as it could be.  Many of these device files will need
        support compiled into your kernel for the hardware.  Read the kernel
        documentation to find details of any particular device.</P
><P
>If you think there are other devices which should be included
        here but aren't then let me know.  I will try to include them in the
        next revision.</P
><DIV
CLASS="GLOSSLIST"
><DL
><DT
><B
><TT
CLASS="FILENAME"
>/dev/dsp</TT
></B
></DT
><DD
><P
>Digital Signal Processor.  Basically this forms
            the interface between software which produces sound and your
            soundcard.  It is a character device on major node 14 and minor
            3.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/fd0</TT
></B
></DT
><DD
><P
>The first floppy drive.  If you are lucky enough
            to have several drives then they will be numbered sequentially.
            It is a character device on major node 2 and minor
            0.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/fb0</TT
></B
></DT
><DD
><P
>The first framebuffer device. A framebuffer is
            an abstraction layer between software and graphics hardware.
            This means that applications do not need to know about what kind
            of hardware you have but merely how to communicate with the
            framebuffer driver's API (Application Programming Interface)
            which is well defined and standardized.  The framebuffer is a
            character device and is on major node 29 and minor
            0.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/hda</TT
></B
></DT
><DD
><P
><TT
CLASS="FILENAME"
>/dev/hda</TT
> is the master IDE
            drive on the primary IDE controller.
            <TT
CLASS="FILENAME"
>/dev/hdb</TT
> the slave drive on the 
            primary controller.  <TT
CLASS="FILENAME"
>/dev/hdc</TT
>
	    , and <TT
CLASS="FILENAME"
>/dev/hdd</TT
>
             are the master and slave devices
            on the secondary controller respectively.  Each disk is divided
            into partitions. Partitions 1-4 are primary partitions and
            partitions 5 and above are logical partitions inside extended
            partitions.  Therefore the device file which references each
            partition is made up of several parts.  For example
            <TT
CLASS="FILENAME"
>/dev/hdc9</TT
> references partition 9 (a logical
            partition inside an extended partition type) on the master IDE
            drive on the secondary IDE controller.  The major and minor node
            numbers are somewhat complex.  For the first IDE controller all
            partitions are block devices on major node 3.  The master drive
            <TT
CLASS="FILENAME"
>hda</TT
> is at minor 0 and the 
            slave drive <TT
CLASS="FILENAME"
>hdb</TT
> is at minor 64.  For 
            each partition inside the drive add the partition number to the minor 
            minor node number for the drive.  For example
            <TT
CLASS="FILENAME"
>/dev/hdb5</TT
> is major 3, minor 69 (64 + 5 =
            69). Drives on the secondary interface are handled the same way,
            but with major node 22.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/ht0</TT
></B
></DT
><DD
><P
>The first IDE tape drive.  Subsequent drives are
            numbered <TT
CLASS="FILENAME"
>ht1</TT
> etc.  They are character
            devices on major node 37 and start at minor node 0 for
            <TT
CLASS="FILENAME"
>ht0</TT
> 1 for <TT
CLASS="FILENAME"
>ht1</TT
>
            etc.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/js0</TT
></B
></DT
><DD
><P
>The first analogue joystick.  Subsequent joysticks
            are numbered <TT
CLASS="FILENAME"
>js1</TT
>, <TT
CLASS="FILENAME"
>js2</TT
>
            etc.  Digital joysticks are called <TT
CLASS="FILENAME"
>djs0</TT
>,
            <TT
CLASS="FILENAME"
>djs1</TT
> and so on.  They are character devices
            on major node 15.  The analogue joysticks start at minor node 0
            and go up to 127 (more than enough for even the most fanatic
            gamer). Digital joysticks start at minor node
            128.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/lp0</TT
></B
></DT
><DD
><P
>The first parallel printer device.  Subsequent
            printers are numbered <TT
CLASS="FILENAME"
>lp1</TT
>,
            <TT
CLASS="FILENAME"
>lp2</TT
> etc.  They are character devices on
            major mode 6 and minor nodes starting at 0 and numbered
            sequentially.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/loop0</TT
></B
></DT
><DD
><P
>The first loopback device.  Loopback devices are
            used for mounting filesystems which are not located on other
            block devices such as disks.  For example if you wish to mount
            an iso9660 CD ROM image without burning it to CD then you need
            to use a loopback device to do so.  This is usually transparent
            to the user and is handled by the <B
CLASS="COMMAND"
>mount</B
>
	    
            command.  Refer to the manual pages for <B
CLASS="COMMAND"
>mount</B
>
            and <B
CLASS="COMMAND"
>losetup</B
>.
            The loopback devices are block
            devices on major node 7 and with minor nodes starting at 0 and
            numbered sequentially.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/md0</TT
></B
></DT
><DD
><P
>First metadisk group.  Metadisks are related to
            RAID (Redundant Array of Independent Disks) devices.  Please
            refer to the most current RAID HOWTO at the LDP for more details.
            This can be found at
            <A
HREF="http://www.tldp.org/HOWTO/Software-RAID-HOWTO.html"
TARGET="_top"
>            http://www.tldp.org/HOWTO/Software-RAID-HOWTO.html</A
>.
            Metadisk devices are block devices on major node 9 with minor
            nodes starting at 0 and numbered
            sequentially.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/mixer</TT
></B
></DT
><DD
><P
>This is part of the OSS (Open Sound System)
	     driver. Refer to the OSS documentation at <A
HREF="http://www.opensound.com"
TARGET="_top"
>http://www.opensound.com</A
>
            for more details.  It is a character device on major node 14,
            minor node 0.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/null</TT
></B
></DT
><DD
><P
>The bit bucket.  A black hole where you can send
            data for it never to be seen again.  Anything sent to
            <TT
CLASS="FILENAME"
>/dev/null</TT
> will disappear.  This can be
            useful if, for example, you wish to run a command but not have
            any feedback appear on the terminal.  It is a character device
            on major node 1 and minor node 3.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/psaux</TT
></B
></DT
><DD
><P
>The PS/2 mouse port.  This is a character device
            on major node 10, minor node 1.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/pda</TT
></B
></DT
><DD
><P
>Parallel port IDE disks.  These are named
            similarly to disks on the internal IDE controllers
            (<TT
CLASS="FILENAME"
>/dev/hd*</TT
>).  They are block devices on major
            node 45. Minor nodes need slightly more explanation here.  The
            first device is <TT
CLASS="FILENAME"
>/dev/pda</TT
> and it is on minor
            node 0.  Partitions on this device are found by adding the
            partition number to the minor number for the device.  Each
            device is limited to 15 partitions each rather than 63 (the
            limit for internal IDE disks).  <TT
CLASS="FILENAME"
>/dev/pdb</TT
>
            
            minor nodes start at 16, <TT
CLASS="FILENAME"
>/dev/pdc</TT
>
	     
            at 32 and <TT
CLASS="FILENAME"
>/dev/pdd</TT
> at 48.  So for example the 
            minor node number for <TT
CLASS="FILENAME"
>/dev/pdc6</TT
> would be 38 (32 +
            6 = 38).  This scheme limits you to 4 parallel disks of 15
            partitions each.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/pcd0</TT
></B
></DT
><DD
><P
>Parallel port CD ROM drives.  These are numbered
            from 0 onwards.  All are block devices on major node 46.
            <TT
CLASS="FILENAME"
>/dev/pcd0</TT
> is on minor node 0 with
            subsequent drives being on minor nodes 1, 2, 3
            etc.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/pt0</TT
></B
></DT
><DD
><P
>Parallel port tape devices.  Tapes do not have
            partitions so these are just numbered sequentially.  They are
            character devices on major node 96.  The minor node numbers
            start from 0 for <TT
CLASS="FILENAME"
>/dev/pt0</TT
>, 1 for
            <TT
CLASS="FILENAME"
>/dev/pt1</TT
>, and so on.
                </P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/parport0</TT
></B
></DT
><DD
><P
>The raw parallel ports.  Most devices which are
            attached to parallel ports have their own drivers.  This is a
            device to access the port directly.  It is a character device on
            major node 99 with minor node 0.  Subsequent devices after the
            first are numbered sequentially incrementing the minor
            node.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/random</TT
> or
            <TT
CLASS="FILENAME"
>/dev/urandom</TT
></B
></DT
><DD
><P
>These are kernel random number generators.
            <TT
CLASS="FILENAME"
>/dev/random</TT
> is a non-deterministic
            generator which means that the value of the next number cannot
            be guessed from the preceding ones.  It uses the entropy of the
            system hardware to generate numbers.  When it has no more
            entropy to use then it must wait until it has collected more
            before it will allow any more numbers to be read from it.
            <TT
CLASS="FILENAME"
>/dev/urandom</TT
> works similarly.  Initially it
            also uses the entropy of the system hardware, but when there is
            no more entropy to use it will continue to return numbers using
            a pseudo random number generating formula.  This is considered
            to be less secure for vital purposes such as cryptographic key
            pair generation.  If security is your overriding concern then
            use <TT
CLASS="FILENAME"
>/dev/random</TT
>, if speed is more important
            then <TT
CLASS="FILENAME"
>/dev/urandom</TT
> works fine.  They are
            character devices on major node 1 with minor nodes 8 for
            <TT
CLASS="FILENAME"
>/dev/random</TT
> and 9 for
            <TT
CLASS="FILENAME"
>/dev/urandom</TT
>.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/sda</TT
></B
></DT
><DD
><P
>The first SCSI drive on the first SCSI bus.  
	    The following drives are named similar to IDE drives.  
	    <TT
CLASS="FILENAME"
>/dev/sdb</TT
> is the second SCSI drive, 
	    <TT
CLASS="FILENAME"
>/dev/sdc</TT
> is the third SCSI drive, and so 
	    forth.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/ttyS0</TT
></B
></DT
><DD
><P
>The first serial port.  Many times this it the port used
	    to connect an external modem to your system.</P
></DD
><DT
><B
><TT
CLASS="FILENAME"
>/dev/zero</TT
></B
></DT
><DD
><P
>This is a simple way of getting many 0s.  Every
            time you read from this device it will return 0.  This can be
            useful sometimes, for example when you want a file of fixed
            length but don't really care what it contains.  It is a
            character device on major node 1 and minor node
            5.</P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="etc-fs.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="usr-fs.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The <TT
CLASS="FILENAME"
>/etc</TT
> directory</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="dir-tree-overview.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The <TT
CLASS="FILENAME"
>/usr</TT
> filesystem.</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>