/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-arm-disk.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-arm-disk.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations) (download) (as text)
Mon Oct 17 19:51:45 2011 UTC (2 years, 5 months ago) by swift
Branch: MAIN
Changes since 1.13: +13 -7 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 vapier 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.14 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-arm-disk.xml,v 1.13 2011/09/04 14:34:01 swift Exp $ -->
8 vapier 1.1
9     <sections>
10    
11 swift 1.14 <version>8</version>
12     <date>2011-10-17</date>
13 vapier 1.1
14 vapier 1.2 <!-- TODO: Add section about MTD and such -->
15    
16 vapier 1.1 <section>
17     <title>Introduction to Block Devices</title>
18 nightmorph 1.8
19 vapier 1.1 <subsection>
20 nightmorph 1.8 <include href="hb-install-blockdevices.xml"/>
21     </subsection>
22 vapier 1.1
23     <subsection>
24     <title>Partitions</title>
25     <body>
26    
27     <p>
28     Although it is theoretically possible to use a full disk to house your Linux
29     system, this is almost never done in practice. Instead, full disk block devices
30     are split up in smaller, more manageable block devices. On <keyval id="arch"/>
31     systems, these are called <e>partitions</e>.
32     </p>
33    
34     <p>
35     Partitions are divided in three types:
36     <e>primary</e>, <e>extended</e> and <e>logical</e>.
37     </p>
38    
39     <p>
40     A <e>primary</e> partition is a partition which has its information stored in
41     the MBR (master boot record). As an MBR is very small (512 bytes) only four
42 nightmorph 1.9 primary partitions can be defined (for instance, <path>/dev/sda1</path> to
43     <path>/dev/sda4</path>).
44 vapier 1.1 </p>
45    
46     <p>
47     An <e>extended</e> partition is a special primary partition (meaning the
48     extended partition must be one of the four possible primary partitions) which
49     contains more partitions. Such a partition didn't exist originally, but as
50     four partitions were too few, it was brought to life to extend the formatting
51     scheme without losing backward compatibility.
52     </p>
53    
54     <p>
55     A <e>logical</e> partition is a partition inside the extended partition. Their
56     definitions aren't placed inside the MBR, but are declared inside the extended
57     partition.
58     </p>
59    
60     </body>
61     </subsection>
62     </section>
63     <section>
64     <title>Designing a Partitioning Scheme</title>
65     <subsection>
66     <title>Default Partitioning Scheme</title>
67     <body>
68    
69     <warn>
70 nightmorph 1.11 The NetWinder firmware, NeTTrom, can only read ext2 partitions reliably so you
71 vapier 1.1 must have a separate ext2 boot partition.
72     </warn>
73    
74     <p>
75     If you are not interested in drawing up a partitioning scheme for your system,
76     you can use the partitioning scheme we use throughout this book:
77     </p>
78    
79     <table>
80     <tr>
81     <th>Partition</th>
82     <th>Filesystem</th>
83     <th>Size</th>
84     <th>Description</th>
85     </tr>
86     <tr>
87 nightmorph 1.9 <ti><path>/dev/sda1</path></ti>
88 vapier 1.1 <ti>ext2</ti>
89     <ti>32M</ti>
90     <ti>Boot partition</ti>
91     </tr>
92     <tr>
93 nightmorph 1.9 <ti><path>/dev/sda2</path></ti>
94 vapier 1.1 <ti>(swap)</ti>
95     <ti>512M</ti>
96     <ti>Swap partition</ti>
97     </tr>
98     <tr>
99 nightmorph 1.9 <ti><path>/dev/sda3</path></ti>
100 vapier 1.1 <ti>ext3</ti>
101     <ti>Rest of the disk</ti>
102     <ti>Root partition</ti>
103     </tr>
104     </table>
105    
106     <p>
107     If you are interested in knowing how big a partition should be, or even how
108     many partitions you need, read on. Otherwise continue now with partitioning
109     your disk by reading <uri link="#fdisk">Using fdisk to Partition your
110     Disk</uri>.
111     </p>
112    
113     </body>
114     </subsection>
115     <subsection>
116     <title>How Many and How Big?</title>
117     <body>
118    
119     <p>
120     The number of partitions is highly dependent on your environment. For instance,
121     if you have lots of users, you will most likely want to have your
122     <path>/home</path> separate as it increases security and makes backups easier.
123     If you are installing Gentoo to perform as a mailserver, your
124     <path>/var</path> should be separate as all mails are stored inside
125     <path>/var</path>. A good choice of filesystem will then maximise your
126     performance. Gameservers will have a separate <path>/opt</path> as most gaming
127     servers are installed there. The reason is similar for <path>/home</path>:
128     security and backups. You will definitely want to keep <path>/usr</path> big:
129     not only will it contain the majority of applications, the Portage tree alone
130     takes around 500 Mbyte excluding the various sources that are stored in it.
131     </p>
132    
133     <p>
134     As you can see, it very much depends on what you want to achieve. Separate
135     partitions or volumes have the following advantages:
136     </p>
137    
138     <ul>
139     <li>
140     You can choose the best performing filesystem for each partition or volume
141     </li>
142     <li>
143     Your entire system cannot run out of free space if one defunct tool is
144     continuously writing files to a partition or volume
145     </li>
146     <li>
147     If necessary, file system checks are reduced in time, as multiple checks can
148     be done in parallel (although this advantage is more with multiple disks than
149     it is with multiple partitions)
150     </li>
151     <li>
152     Security can be enhanced by mounting some partitions or volumes read-only,
153     nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
154     </li>
155     </ul>
156    
157     <p>
158 swift 1.14 However, multiple partitions have disadvantages as well. If not configured
159     properly, you will have a system with lots of free space on one partition and
160     none on another. Another nuisance is that separate partitions - especially
161     for important mountpoints like <path>/usr</path> or <path>/var</path> - often
162     require the administrator to boot with an initramfs to mount the partition
163     before other boot scripts start. This isn't always the case though, so YMMV.
164     </p>
165    
166     <p>
167     There is also a 15-partition limit for SCSI and SATA.
168 vapier 1.1 </p>
169    
170     <p>
171     As an example partitioning, we show you one for a 20GB disk, used as a
172     demonstration laptop (containing webserver, mailserver, gnome, ...):
173     </p>
174    
175     <pre caption="Filesystem usage example">
176     $ <i>df -h</i>
177     Filesystem Type Size Used Avail Use% Mounted on
178 nightmorph 1.9 /dev/sda5 ext3 509M 132M 351M 28% /
179     /dev/sda2 ext3 5.0G 3.0G 1.8G 63% /home
180     /dev/sda7 ext3 7.9G 6.2G 1.3G 83% /usr
181     /dev/sda8 ext3 1011M 483M 477M 51% /opt
182     /dev/sda9 ext3 2.0G 607M 1.3G 32% /var
183     /dev/sda1 ext2 51M 17M 31M 36% /boot
184     /dev/sda6 swap 516M 12M 504M 2% &lt;not mounted&gt;
185 vapier 1.1 <comment>(Unpartitioned space for future usage: 2 GB)</comment>
186     </pre>
187    
188     <p>
189     <path>/usr</path> is rather full (83% used) here, but once
190     all software is installed, <path>/usr</path> doesn't tend to grow that much.
191     Although allocating a few gigabytes of disk space for <path>/var</path> may
192     seem excessive, remember that Portage uses this partition by default for
193     compiling packages. If you want to keep <path>/var</path> at a more reasonable
194     size, such as 1GB, you will need to alter your <c>PORTAGE_TMPDIR</c> variable
195     in <path>/etc/make.conf</path> to point to the partition with enough free space
196     for compiling extremely large packages such as OpenOffice.
197     </p>
198    
199     </body>
200     </subsection>
201     </section>
202     <section id="fdisk">
203     <title>Using fdisk to Partition your Disk</title>
204     <subsection>
205     <body>
206    
207     <p>
208     The following parts explain how to create the example partition layout
209     described previously, namely:
210     </p>
211    
212     <table>
213     <tr>
214     <th>Partition</th>
215     <th>Description</th>
216     </tr>
217     <tr>
218 nightmorph 1.9 <ti><path>/dev/sda1</path></ti>
219 vapier 1.1 <ti>Boot partition</ti>
220     </tr>
221     <tr>
222 nightmorph 1.9 <ti><path>/dev/sda2</path></ti>
223 vapier 1.1 <ti>Swap partition</ti>
224     </tr>
225     <tr>
226 nightmorph 1.9 <ti><path>/dev/sda3</path></ti>
227 vapier 1.1 <ti>Root partition</ti>
228     </tr>
229     </table>
230    
231     <p>
232     Change your partition layout according to your own preference.
233     </p>
234    
235     </body>
236     </subsection>
237     <subsection>
238     <title>Viewing the Current Partition Layout</title>
239     <body>
240    
241     <p>
242     <c>fdisk</c> is a popular and powerful tool to split your disk into partitions.
243     Fire up <c>fdisk</c> on your disk (in our example, we use
244 nightmorph 1.9 <path>/dev/sda</path>):
245 vapier 1.1 </p>
246    
247     <pre caption="Starting fdisk">
248 nightmorph 1.9 # <i>fdisk /dev/sda</i>
249 vapier 1.1 </pre>
250    
251     <p>
252     Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like this:
253     </p>
254    
255     <pre caption="fdisk prompt">
256     Command (m for help):
257     </pre>
258    
259     <p>
260     Type <c>p</c> to display your disk's current partition configuration:
261     </p>
262    
263     <pre caption="An example partition configuration">
264     Command (m for help): <i>p</i>
265    
266 nightmorph 1.9 Disk /dev/sda: 240 heads, 63 sectors, 2184 cylinders
267 vapier 1.1 Units = cylinders of 15120 * 512 bytes
268    
269     Device Boot Start End Blocks Id System
270 nightmorph 1.9 /dev/sda1 1 14 105808+ 83 Linux
271     /dev/sda2 15 49 264600 82 Linux swap
272     /dev/sda3 50 70 158760 83 Linux
273     /dev/sda4 71 2184 15981840 5 Extended
274     /dev/sda5 71 209 1050808+ 83 Linux
275     /dev/sda6 210 348 1050808+ 83 Linux
276     /dev/sda7 349 626 2101648+ 83 Linux
277     /dev/sda8 627 904 2101648+ 83 Linux
278     /dev/sda9 905 2184 9676768+ 83 Linux
279 vapier 1.1
280     Command (m for help):
281     </pre>
282    
283     <p>
284     This particular disk is configured to house seven Linux filesystems (each with
285     a corresponding partition listed as "Linux") as well as a swap partition
286     (listed as "Linux swap").
287     </p>
288    
289     </body>
290     </subsection>
291     <subsection>
292     <title>Removing all Partitions</title>
293     <body>
294    
295     <p>
296     We will first remove all existing partitions from the disk. Type <c>d</c> to
297 nightmorph 1.9 delete a partition. For instance, to delete an existing <path>/dev/sda1</path>:
298 vapier 1.1 </p>
299    
300     <pre caption="Deleting a partition">
301     Command (m for help): <i>d</i>
302     Partition number (1-4): <i>1</i>
303     </pre>
304    
305     <p>
306     The partition has been scheduled for deletion. It will no longer show up if you
307     type <c>p</c>, but it will not be erased until your changes have been saved. If
308     you made a mistake and want to abort without saving your changes, type <c>q</c>
309     immediately and hit enter and your partition will not be deleted.
310     </p>
311    
312     <p>
313     Now, assuming that you do indeed want to wipe out all the partitions on your
314     system, repeatedly type <c>p</c> to print out a partition listing and then type
315     <c>d</c> and the number of the partition to delete it. Eventually, you'll end
316     up with a partition table with nothing in it:
317     </p>
318    
319     <pre caption="An empty partition table">
320 nightmorph 1.9 Disk /dev/sda: 30.0 GB, 30005821440 bytes
321 vapier 1.1 240 heads, 63 sectors/track, 3876 cylinders
322     Units = cylinders of 15120 * 512 = 7741440 bytes
323    
324     Device Boot Start End Blocks Id System
325    
326     Command (m for help):
327     </pre>
328    
329     <p>
330     Now that the in-memory partition table is empty, we're ready to create the
331     partitions. We will use a default partitioning scheme as discussed previously.
332     Of course, don't follow these instructions to the letter if you don't want the
333     same partitioning scheme!
334     </p>
335    
336     </body>
337     </subsection>
338     <subsection>
339     <title>Creating the Boot Partition</title>
340     <body>
341    
342     <p>
343     We first create a small boot partition. Type <c>n</c> to create a new partition,
344     then <c>p</c> to select a primary partition, followed by <c>1</c> to select the
345     first primary partition. When prompted for the first cylinder, hit enter. When
346     prompted for the last cylinder, type <c>+32M</c> to create a partition 32 Mbyte
347     in size:
348     </p>
349    
350     <pre caption="Creating the boot partition">
351     Command (m for help): <i>n</i>
352     Command action
353     e extended
354     p primary partition (1-4)
355     <i>p</i>
356     Partition number (1-4): <i>1</i>
357     First cylinder (1-3876, default 1): <comment>(Hit Enter)</comment>
358     Using default value 1
359     Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): <i>+32M</i>
360     </pre>
361    
362     <p>
363     Now, when you type <c>p</c>, you should see the following partition printout:
364     </p>
365    
366     <pre caption="Created boot partition">
367     Command (m for help): <i>p</i>
368    
369 nightmorph 1.9 Disk /dev/sda: 30.0 GB, 30005821440 bytes
370 vapier 1.1 240 heads, 63 sectors/track, 3876 cylinders
371     Units = cylinders of 15120 * 512 = 7741440 bytes
372    
373     Device Boot Start End Blocks Id System
374 nightmorph 1.9 /dev/sda1 1 14 105808+ 83 Linux
375 vapier 1.1 </pre>
376    
377     <p>
378     We need to make this partition bootable. Type <c>a</c> to toggle the bootable
379     flag on a partition and select <c>1</c>. If you press <c>p</c> again, you will
380     notice that an <path>*</path> is placed in the "Boot" column.
381     </p>
382    
383     </body>
384     </subsection>
385     <subsection>
386     <title>Creating the Swap Partition</title>
387     <body>
388    
389     <p>
390     Let's now create the swap partition. To do this, type <c>n</c> to create a new
391     partition, then <c>p</c> to tell fdisk that you want a primary partition. Then
392 nightmorph 1.9 type <c>2</c> to create the second primary partition, <path>/dev/sda2</path> in
393 vapier 1.1 our case. When prompted for the first cylinder, hit enter. When prompted for
394     the last cylinder, type <c>+512M</c> to create a partition 512MB in size. After
395     you've done this, type <c>t</c> to set the partition type, <c>2</c> to select
396     the partition you just created and then type in <c>82</c> to set the partition
397     type to "Linux Swap". After completing these steps, typing <c>p</c> should
398     display a partition table that looks similar to this:
399     </p>
400    
401     <pre caption="Partition listing after creating a swap partition">
402     Command (m for help): <i>p</i>
403    
404 nightmorph 1.9 Disk /dev/sda: 30.0 GB, 30005821440 bytes
405 vapier 1.1 240 heads, 63 sectors/track, 3876 cylinders
406     Units = cylinders of 15120 * 512 = 7741440 bytes
407    
408     Device Boot Start End Blocks Id System
409 nightmorph 1.9 /dev/sda1 * 1 14 105808+ 83 Linux
410     /dev/sda2 15 81 506520 82 Linux swap
411 vapier 1.1 </pre>
412    
413     </body>
414     </subsection>
415     <subsection>
416     <title>Creating the Root Partition</title>
417     <body>
418    
419     <p>
420     Finally, let's create the root partition. To do this, type <c>n</c> to create a
421     new partition, then <c>p</c> to tell fdisk that you want a primary partition.
422 nightmorph 1.9 Then type <c>3</c> to create the third primary partition, <path>/dev/sda3</path>
423 vapier 1.1 in our case. When prompted for the first cylinder, hit enter. When prompted for
424     the last cylinder, hit enter to create a partition that takes up the rest of the
425     remaining space on your disk. After completing these steps, typing <c>p</c>
426     should display a partition table that looks similar to this:
427     </p>
428    
429     <pre caption="Partition listing after creating the root partition">
430     Command (m for help): <i>p</i>
431    
432 nightmorph 1.9 Disk /dev/sda: 30.0 GB, 30005821440 bytes
433 vapier 1.1 240 heads, 63 sectors/track, 3876 cylinders
434     Units = cylinders of 15120 * 512 = 7741440 bytes
435    
436     Device Boot Start End Blocks Id System
437 nightmorph 1.9 /dev/sda1 * 1 14 105808+ 83 Linux
438     /dev/sda2 15 81 506520 82 Linux swap
439     /dev/sda3 82 3876 28690200 83 Linux
440 vapier 1.1 </pre>
441    
442     </body>
443     </subsection>
444     <subsection>
445     <title>Saving the Partition Layout</title>
446     <body>
447    
448     <p>
449     To save the partition layout and exit <c>fdisk</c>, type <c>w</c>.
450     </p>
451    
452     <pre caption="Save and exit fdisk">
453     Command (m for help): <i>w</i>
454     </pre>
455    
456     <p>
457 nightmorph 1.10 Now that your partitions are created, you can continue with <uri
458 vapier 1.1 link="#filesystems">Creating Filesystems</uri>.
459     </p>
460    
461     </body>
462     </subsection>
463     </section>
464     <section id="filesystems">
465     <title>Creating Filesystems</title>
466     <subsection>
467     <title>Introduction</title>
468     <body>
469    
470     <p>
471     Now that your partitions are created, it is time to place a filesystem on them.
472     If you don't care about what filesystem to choose and are happy with what we use
473     as default in this handbook, continue with <uri
474     link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
475     Otherwise read on to learn about the available filesystems...
476     </p>
477    
478     </body>
479     </subsection>
480 nightmorph 1.8
481 vapier 1.1 <subsection>
482 nightmorph 1.8 <include href="hb-install-filesystems.xml"/>
483     </subsection>
484 vapier 1.1
485     <subsection id="filesystems-apply">
486     <title>Applying a Filesystem to a Partition</title>
487     <body>
488    
489     <p>
490     To create a filesystem on a partition or volume, there are tools available for
491     each possible filesystem:
492     </p>
493    
494     <table>
495     <tr>
496     <th>Filesystem</th>
497     <th>Creation Command</th>
498     </tr>
499     <tr>
500     <ti>ext2</ti>
501 swift 1.12 <ti><c>mkfs.ext2</c></ti>
502 vapier 1.1 </tr>
503     <tr>
504     <ti>ext3</ti>
505 swift 1.13 <ti><c>mkfs.ext3</c></ti>
506     </tr>
507     <tr>
508     <ti>ext4</ti>
509     <ti><c>mkfs.ext4</c></ti>
510 vapier 1.1 </tr>
511     <tr>
512     <ti>reiserfs</ti>
513     <ti><c>mkreiserfs</c></ti>
514     </tr>
515     <tr>
516     <ti>xfs</ti>
517     <ti><c>mkfs.xfs</c></ti>
518     </tr>
519     <tr>
520     <ti>jfs</ti>
521     <ti><c>mkfs.jfs</c></ti>
522     </tr>
523     </table>
524    
525     <p>
526 nightmorph 1.9 For instance, to have the boot partition (<path>/dev/sda1</path> in our
527     example) in ext2 and the root partition (<path>/dev/sda3</path> in our example)
528 vapier 1.1 in ext3 (as in our example), you would use:
529     </p>
530    
531     <pre caption="Applying a filesystem on a partition">
532 swift 1.13 # <i>mkfs.ext2 /dev/sda1</i>
533     # <i>mkfs.ext3 /dev/sda3</i>
534 vapier 1.1 </pre>
535    
536     <p>
537     Now create the filesystems on your newly created partitions (or logical
538     volumes).
539     </p>
540    
541     </body>
542     </subsection>
543     <subsection>
544     <title>Activating the Swap Partition</title>
545     <body>
546    
547     <p>
548     <c>mkswap</c> is the command that is used to initialize swap partitions:
549     </p>
550    
551     <pre caption="Creating a Swap signature">
552 nightmorph 1.9 # <i>mkswap /dev/sda2</i>
553 vapier 1.1 </pre>
554    
555     <p>
556     To activate the swap partition, use <c>swapon</c>:
557     </p>
558    
559     <pre caption="Activating the swap partition">
560 nightmorph 1.9 # <i>swapon /dev/sda2</i>
561 vapier 1.1 </pre>
562    
563     <p>
564     Create and activate the swap with the commands mentioned above.
565     </p>
566    
567     </body>
568     </subsection>
569     </section>
570     <section>
571     <title>Mounting</title>
572     <body>
573    
574     <p>
575     Now that your partitions are initialized and are housing a filesystem, it is
576     time to mount those partitions. Use the <c>mount</c> command. Don't forget to
577     create the necessary mount directories for every partition you created. As an
578     example we mount the root and boot partition:
579     </p>
580    
581     <pre caption="Mounting partitions">
582 nightmorph 1.9 # <i>mount /dev/sda3 /mnt/gentoo</i>
583 vapier 1.1 # <i>mkdir /mnt/gentoo/boot</i>
584 nightmorph 1.9 # <i>mount /dev/sda1 /mnt/gentoo/boot</i>
585 vapier 1.1 </pre>
586    
587     <note>
588     If you want your <path>/tmp</path> to reside on a separate partition, be sure to
589     change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
590     also holds for <path>/var/tmp</path>.
591     </note>
592    
593     <p>
594     We will also have to mount the proc filesystem (a virtual interface with the
595     kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
596     </p>
597    
598     <p>
599     Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
600     Installation Files</uri>.
601     </p>
602    
603     </body>
604     </section>
605     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20