/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (show annotations) (download) (as text)
Mon Oct 17 19:31:38 2011 UTC (2 years, 11 months ago) by swift
Branch: MAIN
Changes since 1.16: +6 -6 lines
File MIME type: application/xml
Bug #372427 - Remove mentioning of EVMS (not sure why or how I missed these paragraphs)

1 <?xml version='1.0' encoding='UTF-8'?>
2 <!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3
4 <!-- The content of this document is licensed under the CC-BY-SA license -->
5 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
6
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml,v 1.16 2011/08/23 17:35:39 swift Exp $ -->
8
9 <sections>
10
11 <abstract>
12 To be able to install Gentoo, you must create the necessary partitions.
13 This chapter describes how to partition a disk for future usage.
14 </abstract>
15
16 <version>10</version>
17 <date>2011-10-17</date>
18
19 <section>
20 <title>Introduction to Block Devices</title>
21
22 <subsection>
23 <include href="hb-install-blockdevices.xml"/>
24 </subsection>
25
26 <subsection>
27 <title>Partitions</title>
28 <body>
29
30 <p>
31 Although it is theoretically possible to use a full disk to house your Linux
32 system, this is almost never done in practice. Instead, full disk block devices
33 are split up in smaller, more manageable block devices. On <keyval id="arch"/>
34 systems, these are called <e>partitions</e>.
35 </p>
36
37 <p>
38 Partitions are divided in three types:
39 <e>primary</e>, <e>extended</e> and <e>logical</e>.
40 </p>
41
42 <p>
43 A <e>primary</e> partition is a partition which has its information stored in
44 the MBR (master boot record). As an MBR is very small (512 bytes) only four
45 primary partitions can be defined (for instance, <path>/dev/sda1</path> to
46 <path>/dev/sda4</path>).
47 </p>
48
49 <p>
50 An <e>extended</e> partition is a special primary partition (meaning the
51 extended partition must be one of the four possible primary partitions) which
52 contains more partitions. Such a partition didn't exist originally, but as
53 four partitions were too few, it was brought to life to extend the formatting
54 scheme without losing backward compatibility.
55 </p>
56
57 <p>
58 A <e>logical</e> partition is a partition inside the extended partition. Their
59 definitions aren't placed inside the MBR, but are declared inside the extended
60 partition.
61 </p>
62
63 </body>
64 </subsection>
65 <subsection>
66 <title>Advanced Storage</title>
67 <body>
68
69 <p>
70 The <keyval id="arch"/> Installation CDs provide support for LVM2.
71 LVM2 increases the flexibility offered by your partitioning setup.
72 During the installation instructions, we will focus on "regular" partitions,
73 but it is still good to know LVM2 is supported as well.
74 </p>
75
76 </body>
77 </subsection>
78 </section>
79 <section>
80 <title>Designing a Partitioning Scheme</title>
81 <subsection>
82 <title>Default Partitioning Scheme</title>
83 <body>
84
85 <p>
86 If you are not interested in drawing up a partitioning scheme for your system,
87 you can use the partitioning scheme we use throughout this book:
88 </p>
89
90 <table>
91 <tr>
92 <th>Partition</th>
93 <th>Filesystem</th>
94 <th>Size</th>
95 <th>Description</th>
96 </tr>
97 <tr>
98 <ti><path>/dev/sda1</path></ti>
99 <ti>ext2</ti>
100 <ti>32M</ti>
101 <ti>Boot partition</ti>
102 </tr>
103 <tr>
104 <ti><path>/dev/sda2</path></ti>
105 <ti>(swap)</ti>
106 <ti>512M</ti>
107 <ti>Swap partition</ti>
108 </tr>
109 <tr>
110 <ti><path>/dev/sda3</path></ti>
111 <ti>ext3</ti>
112 <ti>Rest of the disk</ti>
113 <ti>Root partition</ti>
114 </tr>
115 </table>
116
117 <p>
118 If you are interested in knowing how big a partition should be, or even how
119 many partitions you need, read on. Otherwise continue now with partitioning
120 your disk by reading <uri link="#fdisk">Using fdisk to Partition your
121 Disk</uri> or <uri link="#parted">Using parted to Partition your Disk</uri>
122 (both are partitioning tools, <c>fdisk</c> is well known and stable,
123 <c>parted</c> is a bit more recent but supports partitions larger than
124 2TB).
125 </p>
126
127 </body>
128 </subsection>
129 <subsection>
130 <title>How Many and How Big?</title>
131 <body>
132
133 <p>
134 The number of partitions is highly dependent on your environment. For instance,
135 if you have lots of users, you will most likely want to have your
136 <path>/home</path> separate as it increases security and makes backups easier.
137 If you are installing Gentoo to perform as a mailserver, your
138 <path>/var</path> should be separate as all mails are stored inside
139 <path>/var</path>. A good choice of filesystem will then maximise your
140 performance. Gameservers will have a separate <path>/opt</path> as most gaming
141 servers are installed there. The reason is similar for <path>/home</path>:
142 security and backups. You will definitely want to keep <path>/usr</path> big:
143 not only will it contain the majority of applications, the Portage tree alone
144 takes around 500 Mbyte excluding the various sources that are stored in it.
145 </p>
146
147 <p>
148 As you can see, it very much depends on what you want to achieve. Separate
149 partitions or volumes have the following advantages:
150 </p>
151
152 <ul>
153 <li>
154 You can choose the best performing filesystem for each partition or volume
155 </li>
156 <li>
157 Your entire system cannot run out of free space if one defunct tool is
158 continuously writing files to a partition or volume
159 </li>
160 <li>
161 If necessary, file system checks are reduced in time, as multiple checks can
162 be done in parallel (although this advantage is more with multiple disks than
163 it is with multiple partitions)
164 </li>
165 <li>
166 Security can be enhanced by mounting some partitions or volumes read-only,
167 nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
168 </li>
169 </ul>
170
171 <p>
172 However, multiple partitions have one big disadvantage: if not configured
173 properly, you might result in having a system with lots of free space on one
174 partition and none on another. There is also a 15-partition limit for SCSI and
175 SATA.
176 </p>
177
178 <p>
179 As an example partitioning, we show you one for a 20GB disk, used as a
180 demonstration laptop (containing webserver, mailserver, gnome, ...):
181 </p>
182
183 <pre caption="Filesystem usage example">
184 $ <i>df -h</i>
185 Filesystem Type Size Used Avail Use% Mounted on
186 /dev/sda5 ext3 509M 132M 351M 28% /
187 /dev/sda2 ext3 5.0G 3.0G 1.8G 63% /home
188 /dev/sda7 ext3 7.9G 6.2G 1.3G 83% /usr
189 /dev/sda8 ext3 1011M 483M 477M 51% /opt
190 /dev/sda9 ext3 2.0G 607M 1.3G 32% /var
191 /dev/sda1 ext2 51M 17M 31M 36% /boot
192 /dev/sda6 swap 516M 12M 504M 2% &lt;not mounted&gt;
193 <comment>(Unpartitioned space for future usage: 2 GB)</comment>
194 </pre>
195
196 <p>
197 <path>/usr</path> is rather full (83% used) here, but once
198 all software is installed, <path>/usr</path> doesn't tend to grow that much.
199 Although allocating a few gigabytes of disk space for <path>/var</path> may
200 seem excessive, remember that Portage uses this partition by default for
201 compiling packages. If you want to keep <path>/var</path> at a more reasonable
202 size, such as 1GB, you will need to alter your <c>PORTAGE_TMPDIR</c> variable
203 in <path>/etc/make.conf</path> to point to the partition with enough free space
204 for compiling extremely large packages such as OpenOffice.
205 </p>
206
207 </body>
208 </subsection>
209 </section>
210 <section id="fdisk">
211 <title>Using fdisk to Partition your Disk</title>
212 <subsection>
213 <body>
214
215 <impo>
216 If your environment will deal with partitions larger than 2 TB, please
217 use the <uri link="#parted">Using parted to Partition your Disk</uri>
218 instructions instead. <c>fdisk</c> is not able to deal with larger
219 partitions.
220 </impo>
221
222 <p>
223 The following parts explain how to create the example partition layout
224 using <c>fdisk</c>. The example partition layout was mentioned earlier:
225 </p>
226
227 <table>
228 <tr>
229 <th>Partition</th>
230 <th>Description</th>
231 </tr>
232 <tr>
233 <ti><path>/dev/sda1</path></ti>
234 <ti>Boot partition</ti>
235 </tr>
236 <tr>
237 <ti><path>/dev/sda2</path></ti>
238 <ti>Swap partition</ti>
239 </tr>
240 <tr>
241 <ti><path>/dev/sda3</path></ti>
242 <ti>Root partition</ti>
243 </tr>
244 </table>
245
246 <p>
247 Change your partition layout according to your own preference.
248 </p>
249
250 </body>
251 </subsection>
252 <subsection>
253 <title>Viewing the Current Partition Layout</title>
254 <body>
255
256 <p>
257 <c>fdisk</c> is a popular and powerful tool to split your disk into partitions.
258 Fire up <c>fdisk</c> on your disk (in our example, we use
259 <path>/dev/sda</path>):
260 </p>
261
262 <pre caption="Starting fdisk">
263 # <i>fdisk /dev/sda</i>
264 </pre>
265
266 <p>
267 Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like this:
268 </p>
269
270 <pre caption="fdisk prompt">
271 Command (m for help):
272 </pre>
273
274 <p>
275 Type <c>p</c> to display your disk's current partition configuration:
276 </p>
277
278 <pre caption="An example partition configuration">
279 Command (m for help): <i>p</i>
280
281 Disk /dev/sda: 240 heads, 63 sectors, 2184 cylinders
282 Units = cylinders of 15120 * 512 bytes
283
284 Device Boot Start End Blocks Id System
285 /dev/sda1 * 1 14 105808+ 83 Linux
286 /dev/sda2 15 49 264600 82 Linux swap
287 /dev/sda3 50 70 158760 83 Linux
288 /dev/sda4 71 2184 15981840 5 Extended
289 /dev/sda5 71 209 1050808+ 83 Linux
290 /dev/sda6 210 348 1050808+ 83 Linux
291 /dev/sda7 349 626 2101648+ 83 Linux
292 /dev/sda8 627 904 2101648+ 83 Linux
293 /dev/sda9 905 2184 9676768+ 83 Linux
294
295 Command (m for help):
296 </pre>
297
298 <p>
299 This particular disk is configured to house seven Linux filesystems (each with
300 a corresponding partition listed as "Linux") as well as a swap partition
301 (listed as "Linux swap").
302 </p>
303
304 </body>
305 </subsection>
306 <subsection>
307 <title>Removing all Partitions</title>
308 <body>
309
310 <p>
311 We will first remove all existing partitions from the disk. Type <c>d</c> to
312 delete a partition. For instance, to delete an existing <path>/dev/sda1</path>:
313 </p>
314
315 <pre caption="Deleting a partition">
316 Command (m for help): <i>d</i>
317 Partition number (1-4): <i>1</i>
318 </pre>
319
320 <p>
321 The partition has been scheduled for deletion. It will no longer show up if you
322 type <c>p</c>, but it will not be erased until your changes have been saved. If
323 you made a mistake and want to abort without saving your changes, type <c>q</c>
324 immediately and hit enter and your partition will not be deleted.
325 </p>
326
327 <p>
328 Now, assuming that you do indeed want to wipe out all the partitions on your
329 system, repeatedly type <c>p</c> to print out a partition listing and then type
330 <c>d</c> and the number of the partition to delete it. Eventually, you'll end
331 up with a partition table with nothing in it:
332 </p>
333
334 <pre caption="An empty partition table">
335 Disk /dev/sda: 30.0 GB, 30005821440 bytes
336 240 heads, 63 sectors/track, 3876 cylinders
337 Units = cylinders of 15120 * 512 = 7741440 bytes
338
339 Device Boot Start End Blocks Id System
340
341 Command (m for help):
342 </pre>
343
344 <p>
345 Now that the in-memory partition table is empty, we're ready to create the
346 partitions. We will use a default partitioning scheme as discussed previously.
347 Of course, don't follow these instructions to the letter if you don't want the
348 same partitioning scheme!
349 </p>
350
351 </body>
352 </subsection>
353 <subsection>
354 <title>Creating the Boot Partition</title>
355 <body>
356
357 <p>
358 We first create a small boot partition. Type <c>n</c> to create a new partition,
359 then <c>p</c> to select a primary partition, followed by <c>1</c> to select the
360 first primary partition. When prompted for the first cylinder, hit enter. When
361 prompted for the last cylinder, type <c>+32M</c> to create a partition 32 Mbyte
362 in size and set its bootable flag:
363 </p>
364
365 <pre caption="Creating the boot partition">
366 Command (m for help): <i>n</i>
367 Command action
368 e extended
369 p primary partition (1-4)
370 <i>p</i>
371 Partition number (1-4): <i>1</i>
372 First cylinder (1-3876, default 1): <comment>(Hit Enter)</comment>
373 Using default value 1
374 Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): <i>+32M</i>
375 </pre>
376
377 <p>
378 Now, when you type <c>p</c>, you should see the following partition printout:
379 </p>
380
381 <pre caption="Created boot partition">
382 Command (m for help): <i>p</i>
383
384 Disk /dev/sda: 30.0 GB, 30005821440 bytes
385 240 heads, 63 sectors/track, 3876 cylinders
386 Units = cylinders of 15120 * 512 = 7741440 bytes
387
388 Device Boot Start End Blocks Id System
389 /dev/sda1 1 14 105808+ 83 Linux
390 </pre>
391
392 <p>
393 We need to make this partition bootable. Type <c>a</c> to toggle the bootable
394 flag on a partition and select <c>1</c>. If you press <c>p</c> again, you will
395 notice that an <path>*</path> is placed in the "Boot" column.
396 </p>
397
398 </body>
399 </subsection>
400 <subsection>
401 <title>Creating the Swap Partition</title>
402 <body>
403
404 <p>
405 Let's now create the swap partition. To do this, type <c>n</c> to create a new
406 partition, then <c>p</c> to tell fdisk that you want a primary partition. Then
407 type <c>2</c> to create the second primary partition, <path>/dev/sda2</path> in
408 our case. When prompted for the first cylinder, hit enter. When prompted for
409 the last cylinder, type <c>+512M</c> to create a partition 512MB in size. After
410 you've done this, type <c>t</c> to set the partition type, <c>2</c> to select
411 the partition you just created and then type in <c>82</c> to set the partition
412 type to "Linux Swap". After completing these steps, typing <c>p</c> should
413 display a partition table that looks similar to this:
414 </p>
415
416 <pre caption="Partition listing after creating a swap partition">
417 Command (m for help): <i>p</i>
418
419 Disk /dev/sda: 30.0 GB, 30005821440 bytes
420 240 heads, 63 sectors/track, 3876 cylinders
421 Units = cylinders of 15120 * 512 = 7741440 bytes
422
423 Device Boot Start End Blocks Id System
424 /dev/sda1 * 1 14 105808+ 83 Linux
425 /dev/sda2 15 81 506520 82 Linux swap
426 </pre>
427
428 </body>
429 </subsection>
430 <subsection>
431 <title>Creating the Root Partition</title>
432 <body>
433
434 <p>
435 Finally, let's create the root partition. To do this, type <c>n</c> to create a
436 new partition, then <c>p</c> to tell fdisk that you want a primary partition.
437 Then type <c>3</c> to create the third primary partition, <path>/dev/sda3</path>
438 in our case. When prompted for the first cylinder, hit enter. When prompted for
439 the last cylinder, hit enter to create a partition that takes up the rest of the
440 remaining space on your disk. After completing these steps, typing <c>p</c>
441 should display a partition table that looks similar to this:
442 </p>
443
444 <pre caption="Partition listing after creating the root partition">
445 Command (m for help): <i>p</i>
446
447 Disk /dev/sda: 30.0 GB, 30005821440 bytes
448 240 heads, 63 sectors/track, 3876 cylinders
449 Units = cylinders of 15120 * 512 = 7741440 bytes
450
451 Device Boot Start End Blocks Id System
452 /dev/sda1 * 1 14 105808+ 83 Linux
453 /dev/sda2 15 81 506520 82 Linux swap
454 /dev/sda3 82 3876 28690200 83 Linux
455 </pre>
456
457 </body>
458 </subsection>
459 <subsection>
460 <title>Saving the Partition Layout</title>
461 <body>
462
463 <p>
464 To save the partition layout and exit <c>fdisk</c>, type <c>w</c>.
465 </p>
466
467 <pre caption="Save and exit fdisk">
468 Command (m for help): <i>w</i>
469 </pre>
470
471 <p>
472 Now that your partitions are created, you can continue with <uri
473 link="#filesystems">Creating Filesystems</uri>.
474 </p>
475
476 </body>
477 </subsection>
478 </section>
479 <section id="parted">
480 <title>Using parted to Partition your Disk</title>
481 <subsection>
482 <body>
483
484 <p>
485 In this chapter, we guide you through the creation of the example partition
486 layout mentioned earlier in the instructions. Unlike the previous chapter, we
487 describe the method using the <c>parted</c> application instead. Both
488 <c>parted</c> and <c>fdisk</c> offer the same functions, so if you partitioned
489 your system using <c>fdisk</c> already, you can skip this section and continue
490 with <uri link="#filesystems">Creating Filesystems</uri>.
491 </p>
492
493 <p>
494 The example partition layout we use is shown in the next table:
495 </p>
496
497 <table>
498 <tr>
499 <th>Partition</th>
500 <th>Description</th>
501 </tr>
502 <tr>
503 <ti><path>/dev/sda1</path></ti>
504 <ti>Boot partition</ti>
505 </tr>
506 <tr>
507 <ti><path>/dev/sda2</path></ti>
508 <ti>Swap partition</ti>
509 </tr>
510 <tr>
511 <ti><path>/dev/sda3</path></ti>
512 <ti>Root partition</ti>
513 </tr>
514 </table>
515
516 <p>
517 Change your partition layout according to your own preference.
518 </p>
519
520 </body>
521 </subsection>
522 <subsection>
523 <title>Viewing the Current Partition Layout</title>
524 <body>
525
526 <p>
527 The <c>parted</c> application is a somewhat more modern variant of
528 <c>fdisk</c>. It offers a simpler interface for partitioning your disks and
529 supports very large partitions (more than 2 TB). Fire up <c>parted</c> on your
530 disk (in our example, we use <path>/dev/sda</path>):
531 </p>
532
533 <pre caption="Starting parted">
534 # <i>parted /dev/sda</i>
535 GNU Parted 2.3
536 Using /dev/vda
537 Welcome to GNU Parted! Type 'help' to view a list of commands.
538 </pre>
539
540 <p>
541 To find out about all options supported by <c>parted</c>, type <c>help</c> and
542 press return. For now, we just continue by asking <c>parted</c> to show the
543 partitions currently in use on the selected disk. The <c>print</c> command can
544 be used for that.
545 </p>
546
547 <pre caption="An example partition configuration shown by parted">
548 (parted) <i>print</i>
549 Model: SCSI Block Device
550 Disk /dev/sda: 21.5GB
551 Sector size (logical/physical): 512B/512B
552 Partition Table: msdos
553
554 Number Start End Size Type File system Flags
555 1 512B 2148MB 2148MB primary ext4
556 2 2148MB 3222MB 1074MB primary linux-swap(v1)
557 3 3222MB 21.5GB 18.3GB primary lvm
558 </pre>
559
560 </body>
561 </subsection>
562 <subsection>
563 <title>Optional: Setting the GPT Label</title>
564 <body>
565
566 <p>
567 Most disks on x86/amd64 are prepared using an <e>msdos</e> label. However, if
568 you plan on creating huge partitions (2 TB and more), you must use a <e>gpt</e>
569 label (the <e>GUID Partition Type</e>) for your disk. Using <c>parted</c>, this
570 can be accomplished with <c>mklabel gpt</c>:
571 </p>
572
573 <warn>
574 Changing the partition type will remove all partitions from your disk. All data
575 on the disk will be lost.
576 </warn>
577
578 <pre caption="Setting the GPT label">
579 (parted) <i>mklabel gpt</i>
580 </pre>
581
582 </body>
583 </subsection>
584 <subsection>
585 <title>Removing all Partitions</title>
586 <body>
587
588 <p>
589 If this isn't done yet (for instance through the <c>mklabel</c> operation
590 earlier, or because the disk is a freshly formatted one), we will first
591 remove all existing partitions from the disk. Type <c>rm &lt;number&gt;</c>
592 where &lt;number&gt; is the partition you want to remove.
593 </p>
594
595 <pre caption="Removing a partition from the disk">
596 (parted) <i>rm 2</i>
597 </pre>
598
599 <p>
600 Do the same for all other partitions that you don't need. However, make sure you
601 do not make any mistakes here - <c>parted</c> executes the changes immediate
602 (unlike <c>fdisk</c> which stages them, allowing a user to "undo" his changes
603 before saving or exiting <c>fdisk</c>).
604 </p>
605
606 </body>
607 </subsection>
608 <subsection>
609 <title>Creating the Partitions</title>
610 <body>
611
612 <p>
613 Now let's create the partitions we mentioned earlier. Creating partitions with
614 <c>parted</c> isn't very difficult - all we need to do is inform <c>parted</c>
615 about the following settings:
616 </p>
617
618 <ul>
619 <li>
620 The <e>partition type</e> to use. This usually is <e>primary</e> in case you
621 are not going to have more than 4 partitions (with the <e>msdos</e>
622 partition label). Otherwise, you will need to make your fourth partition an
623 <e>extended</e> one which hosts the rest of the disk, and create
624 <e>logical</e> partitions inside it. If you use a <e>gpt</e>-labeled
625 partition, then there is no limit on the number of primary partitions.
626 </li>
627 <li>
628 The <e>file system type</e> to use. The <c>parted</c> application supports
629 most common file systems and knows which kind of partition ID it needs to
630 use for these partitions. This does <e>not</e> mean that <c>parted</c> will
631 create a file system on the partition (you can with the <c>mkpartfs</c>
632 command, but we'll use the regular <c>mkfs.*</c> commands later for this
633 purpose). The partition ID is often used by auto-detection tools to know
634 what to do with a particular partition.
635 </li>
636 <li>
637 The start location of a partition (which can be expressed in MB or GB)
638 </li>
639 <li>
640 The end location of the partition (which can be expressed in MB or GB)
641 </li>
642 </ul>
643
644 <p>
645 One advantage of <c>parted</c> is that you can easily just use the partition
646 sizes to automatically find the correct start and end location as you will see
647 in the next example.
648 </p>
649
650 <pre caption="Creating the partitions">
651 <comment># Create a 32 mbyte /boot partition</comment>
652 (parted) <i>mkpart primary ext2 0 32mb</i>
653 Warning: The resulting partition is not properly aligned for best performance.
654 Ignore/Cancel? <i>i</i>
655
656 <comment># Create a 512 mbyte swap partition</comment>
657 (parted) <i>mkpart primary linux-swap 32mb 542mb</i>
658
659 <comment># Create a partition that spans the remaining disk.
660 # -1s (minus one s) means the end of the disk</comment>
661 (parted) <i>mkpart primary ext4 542mb -1s</i>
662 Warning: You requested a partition from 542MB to 21.5GB.
663 The closest location we can manage is 542MB to 21.5GB.
664 Is this still acceptable to you?
665 Yes/No? <i>y</i>
666 </pre>
667
668 <p>
669 You can now <c>print</c> the partition layout again to validate if everything is
670 as expected. When you are satisfied, use the <c>quit</c> command to exit
671 <c>parted</c>.
672 </p>
673
674 </body>
675 </subsection>
676 </section>
677 <section id="filesystems">
678 <title>Creating Filesystems</title>
679 <subsection>
680 <title>Introduction</title>
681 <body>
682
683 <p>
684 Now that your partitions are created, it is time to place a filesystem on them.
685 If you don't care about what filesystem to choose and are happy with what we use
686 as default in this handbook, continue with <uri
687 link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
688 Otherwise read on to learn about the available filesystems...
689 </p>
690
691 </body>
692 </subsection>
693
694 <subsection>
695 <include href="hb-install-filesystems.xml"/>
696 </subsection>
697
698 <subsection id="filesystems-apply">
699 <title>Applying a Filesystem to a Partition</title>
700 <body>
701
702 <p>
703 To create a filesystem on a partition or volume, there are tools available for
704 each possible filesystem:
705 </p>
706
707 <table>
708 <tr>
709 <th>Filesystem</th>
710 <th>Creation Command</th>
711 </tr>
712 <tr>
713 <ti>ext2</ti>
714 <ti><c>mkfs.ext2</c></ti>
715 </tr>
716 <tr>
717 <ti>ext3</ti>
718 <ti><c>mkfs.ext3</c></ti>
719 </tr>
720 <tr>
721 <ti>ext4</ti>
722 <ti><c>mkfs.ext4</c></ti>
723 </tr>
724 <tr>
725 <ti>reiserfs</ti>
726 <ti><c>mkreiserfs</c></ti>
727 </tr>
728 <tr>
729 <ti>xfs</ti>
730 <ti><c>mkfs.xfs</c></ti>
731 </tr>
732 <tr>
733 <ti>jfs</ti>
734 <ti><c>mkfs.jfs</c></ti>
735 </tr>
736 </table>
737
738 <p>
739 For instance, to have the boot partition (<path>/dev/sda1</path> in our
740 example) in ext2 and the root partition (<path>/dev/sda3</path> in our example)
741 in ext3 (as in our example), you would use:
742 </p>
743
744 <pre caption="Applying a filesystem on a partition">
745 # <i>mkfs.ext2 /dev/sda1</i>
746 # <i>mkfs.ext3 /dev/sda3</i>
747 </pre>
748
749 <p>
750 Now create the filesystems on your newly created partitions (or logical
751 volumes).
752 </p>
753
754 </body>
755 </subsection>
756 <subsection>
757 <title>Activating the Swap Partition</title>
758 <body>
759
760 <p>
761 <c>mkswap</c> is the command that is used to initialize swap partitions:
762 </p>
763
764 <pre caption="Creating a Swap signature">
765 # <i>mkswap /dev/sda2</i>
766 </pre>
767
768 <p>
769 To activate the swap partition, use <c>swapon</c>:
770 </p>
771
772 <pre caption="Activating the swap partition">
773 # <i>swapon /dev/sda2</i>
774 </pre>
775
776 <p>
777 Create and activate the swap with the commands mentioned above.
778 </p>
779
780 </body>
781 </subsection>
782 </section>
783 <section>
784 <title>Mounting</title>
785 <body>
786
787 <p>
788 Now that your partitions are initialized and are housing a filesystem, it is
789 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
790 create the necessary mount directories for every partition you created. As an
791 example we mount the root and boot partition:
792 </p>
793
794 <pre caption="Mounting partitions">
795 # <i>mount /dev/sda3 /mnt/gentoo</i>
796 # <i>mkdir /mnt/gentoo/boot</i>
797 # <i>mount /dev/sda1 /mnt/gentoo/boot</i>
798 </pre>
799
800 <note>
801 If you want your <path>/tmp</path> to reside on a separate partition, be sure to
802 change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
803 also holds for <path>/var/tmp</path>.
804 </note>
805
806 <p>
807 We will also have to mount the proc filesystem (a virtual interface with the
808 kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
809 </p>
810
811 <p>
812 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
813 Installation Files</uri>.
814 </p>
815
816 </body>
817 </section>
818 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20