File: x1702.html

package info (click to toggle)
sysadmin-guide 0.8-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 840 kB
  • ctags: 2
  • sloc: makefile: 27; sh: 12
file content (529 lines) | stat: -rw-r--r-- 11,607 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
<HTML
><HEAD
><TITLE
>Allocating disk space</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="The Linux System Administrator's Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="Using Disks and Other Storage Media"
HREF="c973.html"><LINK
REL="PREVIOUS"
TITLE="Disks without filesystems"
HREF="x1684.html"><LINK
REL="NEXT"
TITLE="Memory Management"
HREF="memory-management.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"
>The Linux System Administrator's Guide: </TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x1684.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 6. Using Disks and Other Storage Media</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="memory-management.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN1702"
></A
>6.10. Allocating disk space</H1
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1704"
></A
>6.10.1. Partitioning schemes</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
		<A
NAME="AEN1722"
HREF="#FTN.AEN1722"
><SPAN
CLASS="footnote"
>[1]</SPAN
></A
>
	, but it is the only way to be sure you do
	it right.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1724"
></A
>6.10.2. Space requirements</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.</P
><P
>Swap space allocation is discussed in <A
HREF="swap-allocation.html"
>Section 7.5</A
>.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1731"
></A
>6.10.3. Examples of hard disk allocation</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 those
	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"
><A
NAME="AEN1739"
></A
><P
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>5 MB</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>root filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
> 10 MB</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>swap partition</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>180 MB</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="filename"
>/usr</TT
> 
		filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>120 MB</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
><TT
CLASS="filename"
>/home</TT
> 
		filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
> 15 MB</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>scratch partition</TD
></TR
></TBODY
></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).
	
		<A
NAME="AEN1759"
HREF="#FTN.AEN1759"
><SPAN
CLASS="footnote"
>[2]</SPAN
></A
>
	</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN1761"
></A
>6.10.4. Adding more disk space for Linux</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="AEN1765"
></A
>6.10.5. Tips for saving disk space</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 
	or DriveSpace for Windows, the principle is the same.)</P
></DIV
></DIV
><H3
CLASS="FOOTNOTES"
>Notes</H3
><TABLE
BORDER="0"
CLASS="FOOTNOTES"
WIDTH="100%"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN1722"
HREF="x1702.html#AEN1722"
><SPAN
CLASS="footnote"
>[1]</SPAN
></A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>&#13;		This is not actually true, it is possible to move partitions
		and mountpoints without reinstalling, but it is (currently)
		beyond the scope of this book to explain how.  It is on the
		TODO list to write a section on this.  If you have
		experience and knowledge in this area then perhaps you could
		write it for me and save me the bother? :)
		</P
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN1759"
HREF="x1702.html#AEN1759"
><SPAN
CLASS="footnote"
>[2]</SPAN
></A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>This section is somewhat out of date.  Most people 
		these days have disks that stretch into the multiple
		Gigabytes.  It is still quite scalable (just multiply by
		some factor to make it fit your hardware) for the moment
		though, updating it to take
		account of larger disks is planned.</P
></TD
></TR
></TABLE
><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="x1684.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="memory-management.html"
ACCESSKEY="N"
>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="c973.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Memory Management</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>