/[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.18 - (hide annotations) (download) (as text)
Mon Oct 17 19:51:45 2011 UTC (3 years, 1 month ago) by swift
Branch: MAIN
Changes since 1.17: +13 -6 lines
File MIME type: application/xml
Enhancing information on downsides wrt multiple partitions.

This hopefully also clears up some of the confusion that is surrounding
separate /usr partitions. Yes, it now mentions that an initramfs might be
needed in that case.

And no, we do not "recommend" a separate /usr partition, nor do we
"not recommend" it.

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

  ViewVC Help
Powered by ViewVC 1.1.20