/[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.17 - (show annotations) (download) (as text)
Tue Dec 17 10:08:59 2013 UTC (6 months, 3 weeks ago) by swift
Branch: MAIN
CVS Tags: HEAD
Changes since 1.16: +4 -4 lines
File MIME type: application/xml
Bug #489782 - LibreOffice, not OpenOffice (anymore)

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

  ViewVC Help
Powered by ViewVC 1.1.20