/usr/share/doc/sysadmin-guide/html/alloc-disk.html is in sysadmin-guide 0.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Allocating disk space</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="Using Disks and Other Storage Media"
HREF="disk-usage.html"><LINK
REL="PREVIOUS"
TITLE="Disks without filesystems"
HREF="disk-no-fs.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"
>Linux System Administrators Guide: </TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="disk-no-fs.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 5. 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="ALLOC-DISK"
></A
>5.12. Allocating disk space</H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="PART-SCHEMES"
></A
>5.12.1. Partitioning schemes</H2
><P
>When it comes to partitioning your machine,
there is no universally correct way to do it. There are
many factors that must be taken into account depending on
the purpose of the machine.</P
><P
>For a simple workstation with limited disk space, such
as a laptop, you may have as few a 3 partitions. A partition for
<TT
CLASS="FILENAME"
>/</TT
>, <TT
CLASS="FILENAME"
>/boot</TT
>, and swap.
However, for most users this is not a recommended solution.</P
><P
> </P
><P
>The traditional way is to have a (relatively) small
root filesystem, and separate partitions for filesystems such as
<TT
CLASS="FILENAME"
>/usr</TT
> and <TT
CLASS="FILENAME"
>/home></TT
>.
Creating a separate root filesystem if the root filesystem is small and
not heavily used, it is less likely to become corrupt when the system
crashes, and therefore make it easier to recover a crashed system. The
reason is to prevent having the root filesystem get filled and cause a
system crash.</P
><P
>When creating your partitioning scheme, there are some things you
need to remember. You cannot create separate partitions for the following
directories: <TT
CLASS="FILENAME"
>/bin</TT
>, <TT
CLASS="FILENAME"
>/etc</TT
>,
<TT
CLASS="FILENAME"
>/dev</TT
>, <TT
CLASS="FILENAME"
>/initrd</TT
>,
<TT
CLASS="FILENAME"
>/lib</TT
>, and <TT
CLASS="FILENAME"
>/sbin</TT
>. The
contents of these directories are required at bootup and must
always be part of the <TT
CLASS="FILENAME"
>/</TT
> partition.</P
><P
>It is also recommended that you create separate partitions for
<TT
CLASS="FILENAME"
>/var</TT
> and <TT
CLASS="FILENAME"
>/tmp</TT
>. This is
because both directories typically have data that is constantly
changing. Not creating separate partitions for these filesystems
puts you at risk of having log file fill up our <TT
CLASS="FILENAME"
>/</TT
>
partition.</P
><P
>An example of a server partition is:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
><TT
CLASS="COMPUTEROUTPUT"
>Filesystem Size Used Avail Use% Mounted on
/dev/hda2 9.7G 1.3G 8.0G 14% /
/dev/hda1 128M 44M 82M 34% /boot
/dev/hda3 4.9G 4.0G 670M 86% /usr
/dev/hda5 4.9G 2.1G 2.5G 46% /var
/dev/hda7 31G 24G 5.6G 81% /home
/dev/hda8 4.9G 2.0G 670M 43% /opt
</TT
></PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>The problem with having many partitions is that it splits
the total amount of free disk space into many small pieces. One way
to avoid this problem is to use to create Logical Volumes.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="LVM"
></A
>5.12.2. Logical Volume Manager (LVM)</H2
><P
>Using LVM allows administrators the flexibility to create
logical disks that can be expanded dynamically as more disk space
is required.</P
><P
>This is done first by creating partitions with as an
0x8e Linux LVM partition type. Then the <I
CLASS="GLOSSTERM"
>Physical Partitions
</I
> are added to a <I
CLASS="GLOSSTERM"
>Volume Group</I
> and
broken up into chunks, or <I
CLASS="GLOSSTERM"
>Physical Extents</I
>
<I
CLASS="GLOSSTERM"
>Volume Group</I
>. These extends can then be grouped
into <I
CLASS="GLOSSTERM"
>Logical Volumes</I
>. These Logical Volumes
then can be formatted just like a physical partition. The big
difference is that they can be expanded by adding more extents to
them.</P
><P
>Right now, a full discussion of LVM is beyond the scope of this
guide. However, and excellent resource for learning more about LVM
can be found at <A
HREF="http://www.tldp.org/HOWTO/LVM-HOWTO.html"
TARGET="_top"
> http://www.tldp.org/HOWTO/LVM-HOWTO.html</A
>.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="SPACE-REQ"
></A
>5.12.3. 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, a 345 MB hard disk
is really a 330 MB hard disk.</P
><P
>Swap space allocation is discussed in <A
HREF="swap-allocation.html"
>Section 6.5</A
>.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="ALLOC-SPACE-EX"
></A
>5.12.4. Examples of hard disk allocation</H2
><P
>I used to have a 10 GB hard disk. Now I am using a 30 GB
hard disk. I'll explain how and why I partitioned those
disks.</P
><P
>First, I created a <TT
CLASS="FILENAME"
>/boot</TT
> partition
at 128 MG. This is larger than I will need, and big enough to
give me space if I need it. I created a separate
<TT
CLASS="FILENAME"
>/boot</TT
> partition to ensure that this
filesystem will never get filled up, and therefore will be
bootable. Then I created a 5 GB <TT
CLASS="FILENAME"
>/var</TT
>
partition. Since the <TT
CLASS="FILENAME"
>/var</TT
> filesystem is
where log files and email is stored I wanted to isolate it
from my root partition. (I have had log files grow overnight
and fill my root filesystem in the past.) Next, I created a 15 GB
<TT
CLASS="FILENAME"
>/home</TT
> partition. This is handy in the event
of a system crash. If I ever have to re-install Linux from scratch,
I can tell the installation program to not format this partition, and
instead remount it without the data being lost. Finally
since I had 512 MG of RAM I created a 1024 MG (or 1 GB) swap
partition. This left me with roughly a 9 GB root filesystem. I using
my old 10 GB hard drive, I created an 8 GB <TT
CLASS="FILENAME"
>/usr</TT
>
partition and left 2 GB unused. This is incase I need more space
in the future.</P
><P
>In the end, my partition tables looked like this:
<DIV
CLASS="TABLE"
><A
NAME="AEN3270"
></A
><P
><B
>Table 5-3. My Partitions</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>9 GB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>root filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>1 GB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>swap partition</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>5 GB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>/var</TT
>
filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
>15 GB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>/home</TT
>
filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
> 8 GB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="FILENAME"
>/usr</TT
>
filesystem</TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
> 2 GB</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
>scratch partition</TD
></TR
></TBODY
></TABLE
></DIV
>
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="ADDING-DISK"
></A
>5.12.5. 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="SPACE-SAVING-TIPS"
></A
>5.12.6. 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
><P
>Another way to save space is to take special care when
formatting you partitions. Most modern filesystems will allow
you to specify the block size. The block size is chunk size that
the filesystem will use to read and write data. Larger block sizes
will help disk I/O performance when using large files, such as databases.
This happens because the disk can read or write data for a longer
period of time before having to search for the next block. The
</P
></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="disk-no-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="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="disk-usage.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Memory Management</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
|