summaryrefslogtreecommitdiff
path: root/sag-0.6.1-www/sag-0.6.1.html/x1384.html
blob: 677cfa20d211fd7bc0666d9a83fdf1ff50119a9b (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
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
<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN">
<HTML
><HEAD
><TITLE
>Allocating disk space</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet"><LINK
REL="HOME"
TITLE="The Linux System Administrators' Guide"
HREF="book1.html"><LINK
REL="UP"
TITLE="Using Disks and Other Storage Media"
HREF="c701.html"><LINK
REL="PREVIOUS"
TITLE="Disks without filesystems"
HREF="x1366.html"><LINK
REL="NEXT"
TITLE="Memory Management"
HREF="c1450.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="x1366.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 4. Using Disks and Other Storage Media</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="c1450.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN1384"
>Allocating disk space</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1386"
>Partitioning schemes</A
></H2
><P
>It is not easy to partition a disk in the best possible way.
	Worse, there is no universally correct way to do it; there are
	too many factors involved.</P
><P
>The traditional way is to have a (relatively) small
	root filesystem, which contains <TT
CLASS="FILENAME"
>/bin</TT
>,
	<TT
CLASS="FILENAME"
>/etc</TT
>, <TT
CLASS="FILENAME"
>/dev</TT
>,
	<TT
CLASS="FILENAME"
>/lib</TT
>, <TT
CLASS="FILENAME"
>/tmp</TT
>, and other
	stuff that is needed to get the system up and running.	This way,
	the root filesystem (in its own partition or on its own disk)
	is all that is needed to bring up the system.  The reasoning is
	that if the root filesystem is small and is not heavily used,
	it is less likely to become corrupt when the system crashes, and
	you will therefore find it easier to fix any problems caused by
	the crash.  Then you create separate partitions or use separate
	disks for the directory tree below <TT
CLASS="FILENAME"
>/usr</TT
>, the
	users' home directories (often under <TT
CLASS="FILENAME"
>/home</TT
>),
	and the swap space.  Separating the home directories (with the
	users' files) in their own partition makes backups easier, since
	it is usually not necessary to backup programs (which reside
	below <TT
CLASS="FILENAME"
>/usr</TT
>).  In a networked environment it
	is also possible to share <TT
CLASS="FILENAME"
>/usr</TT
> among several
	machines (e.g., by using NFS), thereby reducing the total disk
	space required by several tens or hundreds of megabytes times
	the number of machines.</P
><P
>The problem with having many partitions is that it splits
	the total amount of free disk space into many small pieces.
	Nowadays, when disks and (hopefully) operating systems are
	more reliable, many people prefer to have just one partition
	that holds all their files.  On the other hand, it can be less
	painful to back up (and restore) a small partition.</P
><P
>For a small hard disk (assuming you don't do kernel
	development), the best way to go is probably to have just one
	partition.  For large hard disks, it is probably
	better to have a few large partitions, just in case
	something does go wrong.  (Note that `small' and `large' are
	used in a relative sense here; your needs for disk space
	decide what the threshold is.)</P
><P
>If you have several disks, you might wish to have the
	root filesystem (including <TT
CLASS="FILENAME"
>/usr</TT
>) on one,
	and the users' home directories on another.</P
><P
>It is a good idea to be prepared to experiment a bit
	with different partitioning schemes (over time, not just
	while first installing the system).  This is a bit of work,
	since it essentially requires you to install the system from
	scratch several times, but it is the only way to be sure you do
	it right.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1404"
>Space requirements</A
></H2
><P
>The Linux distribution you install will give some indication
	of how much disk space you need for various configurations.
	Programs installed separately may also do the same.  This will
	help you plan your disk space usage, but you should prepare
	for the future and reserve some extra space for things you will
	notice later that you need.</P
><P
>The amount you need for user files depends on what your
	users wish to do.  Most people seem to need as much space for
	their files as possible, but the amount they will live happily
	with varies a lot.  Some people do only light text processing
	and will survive nicely with a few megabytes, others do heavy
	image processing and will need gigabytes.</P
><P
>By the way, when comparing file sizes given in
	kilobytes or megabytes and disk space given in megabytes, it
	can be important to know that the two units can be different.
	Some disk manufacturers like to pretend that a kilobyte is 1000
	bytes and a megabyte is 1000 kilobytes, while all the rest of
	the computing world uses 1024 for both factors.  Therefore,
	my 345 MB hard disk was really a 330 MB hard disk.
	
		<A
NAME="AEN1409"
HREF="#FTN.AEN1409"
>[1]</A
>
	</P
><P
>Swap space allocation is discussed in <A
HREF="x1532.html"
>the section called <I
>Allocating swap space</I
> in Chapter 5</A
>.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1413"
>Examples of hard disk allocation</A
></H2
><P
>I used to have a 109 MB hard disk.  Now I am using a 330 MB
	hard disk.  I'll explain how and why I partitioned these
	disks.</P
><P
>The 109 MB disk I partitioned in a lot of ways, when my
	needs and the operating systems I used changed; I'll explain
	two typical scenarios.	First, I used to run MS-DOS together
	with Linux.  For that, I needed about 20 MB of hard disk, or
	just enough to have MS-DOS, a C compiler, an editor, a few other
	utilities, the program I was working on, and enough free disk
	space to not feel claustrophobic.  For Linux, I had a 10 MB swap
	partition, and the rest, or 79 MB, was a single partition with all
	the files I had under Linux.  I experimented with having separate
	root, <TT
CLASS="FILENAME"
>/usr</TT
>, and <TT
CLASS="FILENAME"
>/home</TT
>
	partitions, but there was never enough free disk space in one
	piece to do much interesting.</P
><P
>When I didn't need MS-DOS anymore, I repartitioned the
	disk so that I had a 12 MB swap partition, and again had the
	rest as a single filesystem.</P
><P
>The 330 MB disk is partitioned into several partitions, like
	this:

		<DIV
CLASS="INFORMALTABLE"
><P
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>5 MB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>root filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
> 10 MB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>swap partition</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>180 MB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>\fn{/usr} filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>120 MB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>\fn{/home} filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
> 15 MB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>scratch partition</TD
></TR
></TABLE
><P
></P
></DIV
>

	The scratch partition is for playing around with things that
	require their own partition, e.g., trying different Linux
	distributions, or comparing speeds of filesystems.  When not
	needed for anything else, it is used as swap space (I like to
	have a lot of open windows).</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1439"
>Adding more disk space for Linux</A
></H2
><P
>Adding more disk space for Linux is easy, at least after the
	hardware has been properly installed  (the hardware installation
	is outside the scope of this book).  You format it if necessary,
	then create the partitions and filesystem as described above,
	and add the proper lines to <TT
CLASS="FILENAME"
>/etc/fstab</TT
>
	so that it is mounted automatically.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN1443"
>Tips for saving disk space</A
></H2
><P
>The best tip for saving disk space is to avoid installing
	unnecessary programs.  Most Linux distributions have an
	option to install only part of the packages they contain,
	and by analyzing your needs you might notice that you don't
	need most of them.  This will help save a lot of disk space,
	since many programs are quite large.  Even if you do need a
	particular package or program, you might not need all of it.
	For example, some on-line documentation might be unnecessary,
	as might some of the Elisp files for GNU Emacs, some of the
	fonts for X11, or some of the libraries for programming.</P
><P
>If you cannot uninstall packages, you might look into
	compression.  Compression programs such as <B
CLASS="COMMAND"
>gzip</B
>
	or <B
CLASS="COMMAND"
>zip</B
> will compress (and uncompress)
	individual files or groups of files.  The <B
CLASS="COMMAND"
>gzexe</B
>
	system will compress and uncompress programs invisibly to the
	user (unused programs are compressed, then uncompressed as they
	are used).  The experimental DouBle system will compress all
	files in a filesystem, invisibly to the programs that use them.
	(If you are familiar with products such as Stacker for MS-DOS,
	the principle is the same.)</P
></DIV
></DIV
><H3
>Notes</H3
><TABLE
BORDER="0"
CLASS="FOOTNOTES"
WIDTH="100%"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN1409"
HREF="x1384.html#AEN1409"
>[1]</A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>Sic transit discus mundi.</P
></TD
></TR
></TABLE
><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="x1366.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="c1450.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Disks without filesystems</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c701.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Memory Management</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>