/[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.8 - (show annotations) (download) (as text)
Tue Apr 1 08:53:46 2008 UTC (6 years, 8 months ago) by nightmorph
Branch: MAIN
Changes since 1.7: +9 -85 lines
File MIME type: application/xml
release time. note that since this is beta1, the release dir and stage/media names have been adjusted accordingly. also, the handbooks are marked with a disclaimer=draft, so once the final is out, that will be removed and the release names adjusted. in the mean time, these are live. the beta is officially released. no, it's not april fools, but it is april 1st. :)

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/draft/hb-install-arm-disk.xml,v 1.9 2008/03/31 21:48:58 nightmorph Exp $ -->
8
9 <sections>
10
11 <version>6.0</version>
12 <date>2008-04-01</date>
13
14 <!-- TODO: Add section about MTD and such -->
15
16 <section>
17 <title>Introduction to Block Devices</title>
18
19 <subsection>
20 <include href="hb-install-blockdevices.xml"/>
21 </subsection>
22
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 primary partitions can be defined (for instance, <path>/dev/hda1</path> to
43 <path>/dev/hda4</path>).
44 </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 The NetWinder firmware, NeTTrom, can only read ext2 partitions realiably so you
71 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 <ti><path>/dev/hda1</path></ti>
88 <ti>ext2</ti>
89 <ti>32M</ti>
90 <ti>Boot partition</ti>
91 </tr>
92 <tr>
93 <ti><path>/dev/hda2</path></ti>
94 <ti>(swap)</ti>
95 <ti>512M</ti>
96 <ti>Swap partition</ti>
97 </tr>
98 <tr>
99 <ti><path>/dev/hda3</path></ti>
100 <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 However, multiple partitions have one big disadvantage: if not configured
159 properly, you might result in having a system with lots of free space on one
160 partition and none on another. There is also a 15-partition limit for SCSI and
161 SATA.
162 </p>
163
164 <p>
165 As an example partitioning, we show you one for a 20GB disk, used as a
166 demonstration laptop (containing webserver, mailserver, gnome, ...):
167 </p>
168
169 <pre caption="Filesystem usage example">
170 $ <i>df -h</i>
171 Filesystem Type Size Used Avail Use% Mounted on
172 /dev/hda5 ext3 509M 132M 351M 28% /
173 /dev/hda2 ext3 5.0G 3.0G 1.8G 63% /home
174 /dev/hda7 ext3 7.9G 6.2G 1.3G 83% /usr
175 /dev/hda8 ext3 1011M 483M 477M 51% /opt
176 /dev/hda9 ext3 2.0G 607M 1.3G 32% /var
177 /dev/hda1 ext2 51M 17M 31M 36% /boot
178 /dev/hda6 swap 516M 12M 504M 2% &lt;not mounted&gt;
179 <comment>(Unpartitioned space for future usage: 2 GB)</comment>
180 </pre>
181
182 <p>
183 <path>/usr</path> is rather full (83% used) here, but once
184 all software is installed, <path>/usr</path> doesn't tend to grow that much.
185 Although allocating a few gigabytes of disk space for <path>/var</path> may
186 seem excessive, remember that Portage uses this partition by default for
187 compiling packages. If you want to keep <path>/var</path> at a more reasonable
188 size, such as 1GB, you will need to alter your <c>PORTAGE_TMPDIR</c> variable
189 in <path>/etc/make.conf</path> to point to the partition with enough free space
190 for compiling extremely large packages such as OpenOffice.
191 </p>
192
193 </body>
194 </subsection>
195 </section>
196 <section id="fdisk">
197 <title>Using fdisk to Partition your Disk</title>
198 <subsection>
199 <body>
200
201 <p>
202 The following parts explain how to create the example partition layout
203 described previously, namely:
204 </p>
205
206 <table>
207 <tr>
208 <th>Partition</th>
209 <th>Description</th>
210 </tr>
211 <tr>
212 <ti><path>/dev/hda1</path></ti>
213 <ti>Boot partition</ti>
214 </tr>
215 <tr>
216 <ti><path>/dev/hda2</path></ti>
217 <ti>Swap partition</ti>
218 </tr>
219 <tr>
220 <ti><path>/dev/hda3</path></ti>
221 <ti>Root partition</ti>
222 </tr>
223 </table>
224
225 <p>
226 Change your partition layout according to your own preference.
227 </p>
228
229 </body>
230 </subsection>
231 <subsection>
232 <title>Viewing the Current Partition Layout</title>
233 <body>
234
235 <p>
236 <c>fdisk</c> is a popular and powerful tool to split your disk into partitions.
237 Fire up <c>fdisk</c> on your disk (in our example, we use
238 <path>/dev/hda</path>):
239 </p>
240
241 <pre caption="Starting fdisk">
242 # <i>fdisk /dev/hda</i>
243 </pre>
244
245 <p>
246 Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like this:
247 </p>
248
249 <pre caption="fdisk prompt">
250 Command (m for help):
251 </pre>
252
253 <p>
254 Type <c>p</c> to display your disk's current partition configuration:
255 </p>
256
257 <pre caption="An example partition configuration">
258 Command (m for help): <i>p</i>
259
260 Disk /dev/hda: 240 heads, 63 sectors, 2184 cylinders
261 Units = cylinders of 15120 * 512 bytes
262
263 Device Boot Start End Blocks Id System
264 /dev/hda1 1 14 105808+ 83 Linux
265 /dev/hda2 15 49 264600 82 Linux swap
266 /dev/hda3 50 70 158760 83 Linux
267 /dev/hda4 71 2184 15981840 5 Extended
268 /dev/hda5 71 209 1050808+ 83 Linux
269 /dev/hda6 210 348 1050808+ 83 Linux
270 /dev/hda7 349 626 2101648+ 83 Linux
271 /dev/hda8 627 904 2101648+ 83 Linux
272 /dev/hda9 905 2184 9676768+ 83 Linux
273
274 Command (m for help):
275 </pre>
276
277 <p>
278 This particular disk is configured to house seven Linux filesystems (each with
279 a corresponding partition listed as "Linux") as well as a swap partition
280 (listed as "Linux swap").
281 </p>
282
283 </body>
284 </subsection>
285 <subsection>
286 <title>Removing all Partitions</title>
287 <body>
288
289 <p>
290 We will first remove all existing partitions from the disk. Type <c>d</c> to
291 delete a partition. For instance, to delete an existing <path>/dev/hda1</path>:
292 </p>
293
294 <pre caption="Deleting a partition">
295 Command (m for help): <i>d</i>
296 Partition number (1-4): <i>1</i>
297 </pre>
298
299 <p>
300 The partition has been scheduled for deletion. It will no longer show up if you
301 type <c>p</c>, but it will not be erased until your changes have been saved. If
302 you made a mistake and want to abort without saving your changes, type <c>q</c>
303 immediately and hit enter and your partition will not be deleted.
304 </p>
305
306 <p>
307 Now, assuming that you do indeed want to wipe out all the partitions on your
308 system, repeatedly type <c>p</c> to print out a partition listing and then type
309 <c>d</c> and the number of the partition to delete it. Eventually, you'll end
310 up with a partition table with nothing in it:
311 </p>
312
313 <pre caption="An empty partition table">
314 Disk /dev/hda: 30.0 GB, 30005821440 bytes
315 240 heads, 63 sectors/track, 3876 cylinders
316 Units = cylinders of 15120 * 512 = 7741440 bytes
317
318 Device Boot Start End Blocks Id System
319
320 Command (m for help):
321 </pre>
322
323 <p>
324 Now that the in-memory partition table is empty, we're ready to create the
325 partitions. We will use a default partitioning scheme as discussed previously.
326 Of course, don't follow these instructions to the letter if you don't want the
327 same partitioning scheme!
328 </p>
329
330 </body>
331 </subsection>
332 <subsection>
333 <title>Creating the Boot Partition</title>
334 <body>
335
336 <p>
337 We first create a small boot partition. Type <c>n</c> to create a new partition,
338 then <c>p</c> to select a primary partition, followed by <c>1</c> to select the
339 first primary partition. When prompted for the first cylinder, hit enter. When
340 prompted for the last cylinder, type <c>+32M</c> to create a partition 32 Mbyte
341 in size:
342 </p>
343
344 <pre caption="Creating the boot partition">
345 Command (m for help): <i>n</i>
346 Command action
347 e extended
348 p primary partition (1-4)
349 <i>p</i>
350 Partition number (1-4): <i>1</i>
351 First cylinder (1-3876, default 1): <comment>(Hit Enter)</comment>
352 Using default value 1
353 Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): <i>+32M</i>
354 </pre>
355
356 <p>
357 Now, when you type <c>p</c>, you should see the following partition printout:
358 </p>
359
360 <pre caption="Created boot partition">
361 Command (m for help): <i>p</i>
362
363 Disk /dev/hda: 30.0 GB, 30005821440 bytes
364 240 heads, 63 sectors/track, 3876 cylinders
365 Units = cylinders of 15120 * 512 = 7741440 bytes
366
367 Device Boot Start End Blocks Id System
368 /dev/hda1 1 14 105808+ 83 Linux
369 </pre>
370
371 <p>
372 We need to make this partition bootable. Type <c>a</c> to toggle the bootable
373 flag on a partition and select <c>1</c>. If you press <c>p</c> again, you will
374 notice that an <path>*</path> is placed in the "Boot" column.
375 </p>
376
377 </body>
378 </subsection>
379 <subsection>
380 <title>Creating the Swap Partition</title>
381 <body>
382
383 <p>
384 Let's now create the swap partition. To do this, type <c>n</c> to create a new
385 partition, then <c>p</c> to tell fdisk that you want a primary partition. Then
386 type <c>2</c> to create the second primary partition, <path>/dev/hda2</path> in
387 our case. When prompted for the first cylinder, hit enter. When prompted for
388 the last cylinder, type <c>+512M</c> to create a partition 512MB in size. After
389 you've done this, type <c>t</c> to set the partition type, <c>2</c> to select
390 the partition you just created and then type in <c>82</c> to set the partition
391 type to "Linux Swap". After completing these steps, typing <c>p</c> should
392 display a partition table that looks similar to this:
393 </p>
394
395 <pre caption="Partition listing after creating a swap partition">
396 Command (m for help): <i>p</i>
397
398 Disk /dev/hda: 30.0 GB, 30005821440 bytes
399 240 heads, 63 sectors/track, 3876 cylinders
400 Units = cylinders of 15120 * 512 = 7741440 bytes
401
402 Device Boot Start End Blocks Id System
403 /dev/hda1 * 1 14 105808+ 83 Linux
404 /dev/hda2 15 81 506520 82 Linux swap
405 </pre>
406
407 </body>
408 </subsection>
409 <subsection>
410 <title>Creating the Root Partition</title>
411 <body>
412
413 <p>
414 Finally, let's create the root partition. To do this, type <c>n</c> to create a
415 new partition, then <c>p</c> to tell fdisk that you want a primary partition.
416 Then type <c>3</c> to create the third primary partition, <path>/dev/hda3</path>
417 in our case. When prompted for the first cylinder, hit enter. When prompted for
418 the last cylinder, hit enter to create a partition that takes up the rest of the
419 remaining space on your disk. After completing these steps, typing <c>p</c>
420 should display a partition table that looks similar to this:
421 </p>
422
423 <pre caption="Partition listing after creating the root partition">
424 Command (m for help): <i>p</i>
425
426 Disk /dev/hda: 30.0 GB, 30005821440 bytes
427 240 heads, 63 sectors/track, 3876 cylinders
428 Units = cylinders of 15120 * 512 = 7741440 bytes
429
430 Device Boot Start End Blocks Id System
431 /dev/hda1 * 1 14 105808+ 83 Linux
432 /dev/hda2 15 81 506520 82 Linux swap
433 /dev/hda3 82 3876 28690200 83 Linux
434 </pre>
435
436 </body>
437 </subsection>
438 <subsection>
439 <title>Saving the Partition Layout</title>
440 <body>
441
442 <p>
443 To save the partition layout and exit <c>fdisk</c>, type <c>w</c>.
444 </p>
445
446 <pre caption="Save and exit fdisk">
447 Command (m for help): <i>w</i>
448 </pre>
449
450 <p>
451 Now that your partitions are created, you can now continue with <uri
452 link="#filesystems">Creating Filesystems</uri>.
453 </p>
454
455 </body>
456 </subsection>
457 </section>
458 <section id="filesystems">
459 <title>Creating Filesystems</title>
460 <subsection>
461 <title>Introduction</title>
462 <body>
463
464 <p>
465 Now that your partitions are created, it is time to place a filesystem on them.
466 If you don't care about what filesystem to choose and are happy with what we use
467 as default in this handbook, continue with <uri
468 link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
469 Otherwise read on to learn about the available filesystems...
470 </p>
471
472 </body>
473 </subsection>
474
475 <subsection>
476 <include href="hb-install-filesystems.xml"/>
477 </subsection>
478
479 <subsection id="filesystems-apply">
480 <title>Applying a Filesystem to a Partition</title>
481 <body>
482
483 <p>
484 To create a filesystem on a partition or volume, there are tools available for
485 each possible filesystem:
486 </p>
487
488 <table>
489 <tr>
490 <th>Filesystem</th>
491 <th>Creation Command</th>
492 </tr>
493 <tr>
494 <ti>ext2</ti>
495 <ti><c>mke2fs</c></ti>
496 </tr>
497 <tr>
498 <ti>ext3</ti>
499 <ti><c>mke2fs -j</c></ti>
500 </tr>
501 <tr>
502 <ti>reiserfs</ti>
503 <ti><c>mkreiserfs</c></ti>
504 </tr>
505 <tr>
506 <ti>xfs</ti>
507 <ti><c>mkfs.xfs</c></ti>
508 </tr>
509 <tr>
510 <ti>jfs</ti>
511 <ti><c>mkfs.jfs</c></ti>
512 </tr>
513 </table>
514
515 <p>
516 For instance, to have the boot partition (<path>/dev/hda1</path> in our
517 example) in ext2 and the root partition (<path>/dev/hda3</path> in our example)
518 in ext3 (as in our example), you would use:
519 </p>
520
521 <pre caption="Applying a filesystem on a partition">
522 # <i>mke2fs /dev/hda1</i>
523 # <i>mke2fs -j /dev/hda3</i>
524 </pre>
525
526 <p>
527 Now create the filesystems on your newly created partitions (or logical
528 volumes).
529 </p>
530
531 </body>
532 </subsection>
533 <subsection>
534 <title>Activating the Swap Partition</title>
535 <body>
536
537 <p>
538 <c>mkswap</c> is the command that is used to initialize swap partitions:
539 </p>
540
541 <pre caption="Creating a Swap signature">
542 # <i>mkswap /dev/hda2</i>
543 </pre>
544
545 <p>
546 To activate the swap partition, use <c>swapon</c>:
547 </p>
548
549 <pre caption="Activating the swap partition">
550 # <i>swapon /dev/hda2</i>
551 </pre>
552
553 <p>
554 Create and activate the swap with the commands mentioned above.
555 </p>
556
557 </body>
558 </subsection>
559 </section>
560 <section>
561 <title>Mounting</title>
562 <body>
563
564 <p>
565 Now that your partitions are initialized and are housing a filesystem, it is
566 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
567 create the necessary mount directories for every partition you created. As an
568 example we mount the root and boot partition:
569 </p>
570
571 <pre caption="Mounting partitions">
572 # <i>mount /dev/hda3 /mnt/gentoo</i>
573 # <i>mkdir /mnt/gentoo/boot</i>
574 # <i>mount /dev/hda1 /mnt/gentoo/boot</i>
575 </pre>
576
577 <note>
578 If you want your <path>/tmp</path> to reside on a separate partition, be sure to
579 change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
580 also holds for <path>/var/tmp</path>.
581 </note>
582
583 <p>
584 We will also have to mount the proc filesystem (a virtual interface with the
585 kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
586 </p>
587
588 <p>
589 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
590 Installation Files</uri>.
591 </p>
592
593 </body>
594 </section>
595 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20