summaryrefslogtreecommitdiff
path: root/sag-0.6.1-www/sag-0.6.1.html/c212.html
blob: 10609030875a91b8b5fe90aac56e815c1f9e1322 (plain)
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
<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN">
<HTML
><HEAD
><TITLE
>Overview of the Directory Tree</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet"><LINK
REL="HOME"
TITLE="The Linux System Administrators' Guide"
HREF="book1.html"><LINK
REL="PREVIOUS"
TITLE="Major services in a UNIX system"
HREF="x94.html"><LINK
REL="NEXT"
TITLE="The root filesystem"
HREF="x267.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Linux System Administrators' Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x94.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x267.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="DIR-TREE-OVERVIEW"
>Chapter 3. Overview of the Directory Tree</A
></H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="c212.html#AEN218"
>Background</A
></DT
><DT
><A
HREF="x267.html"
>The root filesystem</A
></DT
><DT
><A
HREF="x338.html"
>The <TT
CLASS="FILENAME"
>/etc</TT
> directory</A
></DT
><DT
><A
HREF="x463.html"
>The <TT
CLASS="FILENAME"
>/dev</TT
> directory</A
></DT
><DT
><A
HREF="x472.html"
>The <TT
CLASS="FILENAME"
>/usr</TT
> filesystem</A
></DT
><DT
><A
HREF="x531.html"
>The <TT
CLASS="FILENAME"
>/var</TT
> filesystem</A
></DT
><DT
><A
HREF="x595.html"
>The <TT
CLASS="FILENAME"
>/proc</TT
> filesystem</A
></DT
></DL
></DIV
><BLOCKQUOTE
><P
>&#8220; Two days later, there was Pooh, sitting
	on his branch, dangling his legs, and there, beside him, were
	four pots of honey...&#8221; (A.A.\ Milne) </P
></BLOCKQUOTE
><P
>This chapter describes the important parts of a standard
	Linux directory tree, based on the FSSTND filesystem
	standard.  It outlines the normal way of breaking the directory
	tree into separate filesystems with different purposes and gives
	the motivation behind this particular split.  Some alternative
	ways of splitting are also described.</P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN218"
>Background</A
></H1
><P
>This chapter is loosely based on the <I
CLASS="CITETITLE"
>Linux
	filesystem standard</I
>, FSSTND, version 1.2 (see
	the bibliography), which attempts to set a standard for how
	the directory tree in a Linux system is organized.  Such a
	standard has the advantage that it will be easier to write or
	port software for Linux, and to administer Linux machines, since
	everything will be in their usual places.  There is no authority
	behind the standard that forces anyone to comply with it, but it
	has got the support of most, if not all, Linux distributions.
	It is not a good idea to break with the FSSTND without very
	compelling reasons.  The FSSTND attempts to follow Unix tradition
	and current trends, making Linux systems familiar to those with
	experience with other Unix systems, and vice versa.</P
><P
>This chapter is not as detailed as the FSSTND.  A system
	administrator should also read the FSSTND for a complete
	understanding.</P
><P
>This chapter does not explain all files in detail.
	The intention is not to describe every file, but to give
	an overview of the system from a filesystem point of view.
	Further information on each file is available elsewhere in this
	manual or the manual pages.</P
><P
>The full directory tree is intended to be breakable
	into smaller parts, each on its own disk or partition,
	to accomodate to disk size limits and to ease backup
	and other system administration.  The major parts are the
	root, <TT
CLASS="FILENAME"
>/usr</TT
>, <TT
CLASS="FILENAME"
>/var</TT
>, and 
	<TT
CLASS="FILENAME"
>/home</TT
> filesystems (see
	<A
HREF="c212.html#FSTREE"
>Figure 3-1</A
>).  Each part has a different purpose.
	The directory tree has been designed so that it works well in
	a network of Linux machines which may share some parts of the
	filesystems over a read-only device (e.g., a CD-ROM), or over
	the network with NFS.</P
><DIV
CLASS="FIGURE"
><P
><B
><A
NAME="FSTREE"
>Figure 3-1. Parts of a Unix directory tree. Dashed lines indicate partition limits.</A
></B
></P
><P
><IMG
SRC="fstree.gif"></P
></DIV
><P
>The roles of the different parts of the directory tree are
	described below.

	<P
></P
><UL
><LI
><P
>The root filesystem is specific for
		each machine (it is generally stored on a local disk,
		although it could be a ramdisk or network drive as well)
		and contains the files that are necessary for booting
		the system up, and to bring it up to such a state that
		the other filesystems may be mounted.  The contents of
		the root filesystem will therefore be sufficient for
		the single user state.	It will also contain tools for
		fixing a broken system, and for recovering lost files
		from backups.</P
></LI
><LI
><P
> The <TT
CLASS="FILENAME"
>/usr</TT
> filesystem
		contains all commands, libraries, manual pages, and
		other unchanging files needed during normal operation.
		No files in <TT
CLASS="FILENAME"
>/usr</TT
> should be specific
		for any given machine, nor should they be modified during
		normal use.  This allows the files to be shared over
		the network, which can be cost-effective since it saves
		disk space (there can easily be hundreds of megabytes in
		<TT
CLASS="FILENAME"
>/usr</TT
>), and can make administration
		easier (only the master <TT
CLASS="FILENAME"
>/usr</TT
> needs to
		be changed when updating an application, not each machine
		separately).  Even if the filesystem is on a local disk,
		it could be mounted read-only, to lessen the chance of
		filesystem corruption during a crash.</P
></LI
><LI
><P
>The <TT
CLASS="FILENAME"
>/var</TT
>
		filesystem contains files that change, such as spool
		directories (for mail, news, printers, etc), log
		files, formatted manual pages, and temporary files.
		Traditionally everything in <TT
CLASS="FILENAME"
>/var</TT
>
		has been somewhere below <TT
CLASS="FILENAME"
>/usr</TT
>, but
		that made it impossible to mount <TT
CLASS="FILENAME"
>/usr</TT
>
		read-only.</P
><P
></P
></LI
><LI
><P
> The <TT
CLASS="FILENAME"
>/home</TT
>
		filesystem contains the users' home directories, i.e., all
		the real data on the system.  Separating home directories
		to their own directory tree or filesystem makes backups
		easier; the other parts often do not have to be backed
		up, or at least not as often (they seldom change).
		A big <TT
CLASS="FILENAME"
>/home</TT
> might have to be
		broken on several filesystems, which requires adding an
		extra naming level below <TT
CLASS="FILENAME"
>/home</TT
>,
		e.g., <TT
CLASS="FILENAME"
>/home/students</TT
> and
		<TT
CLASS="FILENAME"
>/home/staff</TT
>.</P
></LI
></UL
> </P
><P
>Although the different parts have been called filesystems
	above, there is no requirement that they actually be on separate
	filesystems.  They could easily be kept in a single one if the
	system is a small single-user system and the user wants to keep
	things simple.	The directory tree might also be divided into
	filesystems differently, depending on how large the disks are, and
	how space is allocated for various purposes.  The important part,
	though, is that all the standard <I
CLASS="EMPHASIS"
>names</I
>
	work; even if, say, <TT
CLASS="FILENAME"
>/var</TT
> and
	<TT
CLASS="FILENAME"
>/usr</TT
> are actually on the same
	partition, the names <TT
CLASS="FILENAME"
>/usr/lib/libc.a</TT
>
	and <TT
CLASS="FILENAME"
>/var/log/messages</TT
> must work, for
	example by moving files below <TT
CLASS="FILENAME"
>/var</TT
>
	into <TT
CLASS="FILENAME"
>/usr/var</TT
>, and
	making <TT
CLASS="FILENAME"
>/var</TT
> a symlink to
	<TT
CLASS="FILENAME"
>/usr/var</TT
>.</P
><P
>The Unix filesystem structure groups files according to purpose,
	i.e., all commands are in one place, all data files in another,
	documentation in a third, and so on.  An alternative would be to
	group files files according to the program they belong to, i.e.,
	all Emacs files would be in one directory, all TeX in another,
	and so on.  The problem with the latter approach is that it
	makes it difficult to share files (the program directory often
	contains both static and shareable and changing and
	non-shareable files), and sometimes to even find the files
	(e.g., manual pages in a huge number of places, and making the
	manual page programs find all of them is a maintenance
	nightmare).</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x94.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x267.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Major services in a UNIX system</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The root filesystem</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>