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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.38 - (show annotations) (download) (as text)
Mon May 7 18:11:41 2007 UTC (7 years, 4 months ago) by nightmorph
Branch: MAIN
Changes since 1.37: +284 -159 lines
File MIME type: application/xml
2007.0 release is here; final changes and new docs

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-ppc-disk.xml,v 1.25 2007/04/02 00:23:40 nightmorph Exp $ -->
8
9 <sections>
10
11 <version>8.0</version>
12 <date>2007-05-07</date>
13
14 <section>
15 <title>Introduction to Block Devices</title>
16 <subsection>
17 <title>Block Devices</title>
18 <body>
19
20 <p>
21 We'll start by taking a good look at disk-oriented aspects of Gentoo Linux
22 and Linux in general, including Linux filesystems, partitions and block devices.
23 Then, once you're familiar with the ins and outs of disks and filesystems,
24 you'll be guided through the process of setting up partitions and filesystems
25 for your Gentoo Linux installation.
26 </p>
27
28 <p>
29 To begin, we'll introduce <e>block devices</e>. The most common block device is
30 the one that represents the first IDE drive in a Linux system, namely
31 <path>/dev/hda</path>. If you are installing onto SCSI, FireWire, USB or SATA
32 drives, then your first hard drive would be <path>/dev/sda</path>. Additional
33 drives are enumerated by the next letter in the alphabet. As an example, the
34 third IDE disk could be found at <path>/dev/hdc</path>.
35 </p>
36
37 <p>
38 The block devices above represent an abstract interface to the disk. User
39 programs can use these block devices to interact with the disk without worrying
40 about whether the drives are IDE, SCSI or something else. The program can
41 simply address the storage on the disk as a bunch of contiguous,
42 randomly-accessible 512-byte blocks.
43 </p>
44
45 </body>
46 </subsection>
47 <subsection>
48 <title>Partitions</title>
49 <body>
50
51 <p>
52 Although it is theoretically possible to use a full disk to house your Linux
53 system, this is almost never done in practice. Instead, full disk block devices
54 are split up in smaller, more manageable block devices. On most systems,
55 these are called <e>partitions</e>.
56 </p>
57
58 </body>
59 </subsection>
60 </section>
61 <section>
62 <title>Designing a Partitioning Scheme</title>
63 <subsection>
64 <title>Default Partitioning Scheme</title>
65 <body>
66
67 <p>
68 If you are not interested in drawing up a partitioning scheme for your system,
69 you can use the partitioning scheme we use throughout this book. Choose the
70 filesystem layout that best matches the type of PowerPC system you are
71 installing on.
72 </p>
73
74 </body>
75 </subsection>
76 <subsection>
77 <title>Apple New World</title>
78 <body>
79
80 <p>
81 Apple New World machines are fairly straightforward to configure. The first
82 partition is always an <e>Apple Partition Map</e>. This partition keeps track
83 of the layout of the disk. You cannot remove this partition. The next
84 partition should always be a bootstrap partition. This partition contains a
85 small (800k) HFS filesystem that holds a copy of the bootloader Yaboot and its
86 configuration file. This partition is <e>not</e> the same as a
87 <path>/boot</path> partition as found on other architectures. After the boot
88 partition, the usual Linux filesystems are placed, according to the scheme
89 below. The swap partition is a temporary storage place for when your system
90 runs out of physical memory. The root partition will contain the filesystem
91 that Gentoo is installed on. If you wish to dual boot, the OSX partition
92 can go anywhere after the bootstrap partition to insure that yaboot starts
93 first.
94 </p>
95
96 <note>
97 There may be "Disk Driver" partitions on your disk such as <path>Apple_Driver63,
98 Apple_Driver_ATA, Apple_FWDriver, Apple_Driver_IOKit, Apple_Patches</path>.
99 These are used to boot MacOS, so if you have no need for this, you can remove
100 them by initializing the disk with mac-fdisk's <c>i</c> option. This will
101 completely erase the disk! If you are in doubt, just let them be.
102 </note>
103
104 <note>
105 If you partitioned this disk with Apple's Disk Utility, there may be
106 128Mb spaces between partitions which Apple reserves for "future use". You
107 can safely remove these.
108 </note>
109
110 <table>
111 <tr>
112 <th>Partition</th>
113 <th>Size</th>
114 <th>Filesystem</th>
115 <th>Description</th>
116 </tr>
117 <tr>
118 <ti><path>/dev/hda1</path></ti>
119 <ti>32k</ti>
120 <ti>None</ti>
121 <ti>Apple Partition Map</ti>
122 </tr>
123 <tr>
124 <ti><path>/dev/hda2</path></ti>
125 <ti>800k</ti>
126 <ti>HFS</ti>
127 <ti>Apple Bootstrap</ti>
128 </tr>
129 <tr>
130 <ti><path>/dev/hda3</path></ti>
131 <ti>512Mb</ti>
132 <ti>Swap</ti>
133 <ti>Linux Swap</ti>
134 </tr>
135 <tr>
136 <ti><path>/dev/hda4</path></ti>
137 <ti>Rest of Disk</ti>
138 <ti>ext3, reiserfs, xfs</ti>
139 <ti>Linux Root</ti>
140 </tr>
141 </table>
142
143 </body>
144 </subsection>
145 <subsection>
146 <title>Apple Old World</title>
147 <body>
148
149 <p>
150 Apple Old World machines are a bit more complicated to configure. The first
151 partition is always an <e>Apple Partition Map</e>. This partition keeps track
152 of the layout of the disk. You cannot remove this partition. If you are using
153 BootX, the configuration below assumes that MacOS is installed on a seperate
154 disk. If this is not the case, there will be additional partitions for "Apple
155 Disk Drivers" such as <path>Apple_Driver63, Apple_Driver_ATA, Apple_FWDriver,
156 Apple_Driver_IOKit, Apple_Patches</path> and the MacOS install. If you are
157 using Quik, you will need to create a boot partition to hold the kernel, unlike
158 other Apple boot methods. After the boot partition, the usual Linux filesystems
159 are placed, according to the scheme below. The swap partition is a temporary
160 storage place for when your system runs out of physical memory. The root
161 partition will contain the filesystem that Gentoo is installed on.
162 </p>
163
164 <note>
165 If you are using an OldWorld machine, you will need to keep MacOS available.
166 The layout here assumes MacOS is installed on a separate drive.
167 </note>
168
169 <table>
170 <tr>
171 <th>Partition</th>
172 <th>Size</th>
173 <th>Filesystem</th>
174 <th>Description</th>
175 </tr>
176 <tr>
177 <ti><path>/dev/hda1</path></ti>
178 <ti>32k</ti>
179 <ti>None</ti>
180 <ti>Apple Partition Map</ti>
181 </tr>
182 <tr>
183 <ti><path>/dev/hda2</path></ti>
184 <ti>32Mb</ti>
185 <ti>ext2</ti>
186 <ti>Quik Boot Partition (quik only)</ti>
187 </tr>
188 <tr>
189 <ti><path>/dev/hda3</path></ti>
190 <ti>512Mb</ti>
191 <ti>Swap</ti>
192 <ti>Linux Swap</ti>
193 </tr>
194 <tr>
195 <ti><path>/dev/hda4</path></ti>
196 <ti>Rest of Disk</ti>
197 <ti>ext3, reiserfs, xfs</ti>
198 <ti>Linux Root</ti>
199 </tr>
200 </table>
201
202 </body>
203 </subsection>
204 <subsection>
205 <title>Pegasos</title>
206 <body>
207
208 <p>
209 The Pegaos partition layout is quite simple compared to the Apple layouts.
210 The first partition is a Boot Partition, which contains kernels to be booted,
211 along with an OpenFirmware script that presents a menu on boot. After the boot
212 partition, the usual Linux filesystems are placed, according to the scheme
213 below. The swap partition is a temporary storage place for when your system
214 runs out of physical memory. The root partition will contain the filesystem
215 that Gentoo is installed on.
216 </p>
217
218 <table>
219 <tr>
220 <th>Partition</th>
221 <th>Size</th>
222 <th>Filesystem</th>
223 <th>Description</th>
224 </tr>
225 <tr>
226 <ti><path>/dev/hda1</path></ti>
227 <ti>32Mb</ti>
228 <ti>affs1 or ext2</ti>
229 <ti>Boot Partition</ti>
230 </tr>
231 <tr>
232 <ti><path>/dev/hda2</path></ti>
233 <ti>512Mb</ti>
234 <ti>Swap</ti>
235 <ti>Linux Swap</ti>
236 </tr>
237 <tr>
238 <ti><path>/dev/hda3</path></ti>
239 <ti>Rest of Disk</ti>
240 <ti>ext3, reiserfs, xfs</ti>
241 <ti>Linux Root</ti>
242 </tr>
243 </table>
244
245 </body>
246 </subsection>
247 <subsection>
248 <title>IBM PReP (RS/6000)</title>
249 <body>
250
251 <p>
252 The Pegaos partition layout is quite simple compared to the Apple layouts.
253 The first partition is a Boot Partition, which contains kernels to be booted,
254 along with an OpenFirmware script that presents a menu on boot. After the boot
255 partition, the usual Linux filesystems are placed, according to the scheme
256 below. The swap partition is a temporary storage place for when your system
257 runs out of physical memory. The root partition will contain the filesystem
258 that Gentoo is installed on.
259 </p>
260
261 <table>
262 <tr>
263 <th>Partition</th>
264 <th>Size</th>
265 <th>Filesystem</th>
266 <th>Description</th>
267 </tr>
268 <tr>
269 <ti><path>/dev/hda1</path></ti>
270 <ti>800k</ti>
271 <ti>None</ti>
272 <ti>PReP Boot Partition (Type 0x41)</ti>
273 </tr>
274 <tr>
275 <ti><path>/dev/hda2</path></ti>
276 <ti>512Mb</ti>
277 <ti>Swap</ti>
278 <ti>Linux Swap (Type 0x82)</ti>
279 </tr>
280 <tr>
281 <ti><path>/dev/hda3</path></ti>
282 <ti>Rest of Disk</ti>
283 <ti>ext3, reiserfs, xfs</ti>
284 <ti>Linux Root (Type 0x83)</ti>
285 </tr>
286 </table>
287
288 <warn>
289 <c>parted</c> is able to resize partitions including HFS+. Unfortunately there
290 may be issues with resizing HFS+ journaled filesystems, so, for the best
291 results, switch off journaling in Mac OS X before resizing. Remember that any
292 resizing operation is dangerous, so attempt at your own risk! Be sure to always
293 have a backup of your data before resizing!
294 </warn>
295
296 <p>
297 If you are interested in knowing how big a partition should be, or even how many
298 partitions you need, read on. Otherwise continue now with
299 <uri link="#mac-fdisk"> Default: Using mac-fdisk (Apple) to Partition your Disk
300 </uri> or <uri link="#parted">Alternative: Using parted (IBM/Pegasos) to
301 Partition your Disk</uri>.
302 </p>
303
304 </body>
305 </subsection>
306 <subsection>
307 <title>How Many and How Big?</title>
308 <body>
309
310 <p>
311 The number of partitions is highly dependent on your environment. For instance,
312 if you have lots of users, you will most likely want to have your
313 <path>/home</path> separate as it increases security and makes backups easier.
314 If you are installing Gentoo to perform as a mailserver, your <path>/var</path>
315 should be separate as all received mail is stored in <path>/var</path>. A good
316 choice of filesystem will then maximise your performance. Game servers should
317 have a separate <path>/opt</path> as most game servers are installed there. The
318 reason is similar for <path>/home</path>: security and backups. Whatever layout
319 you chose, you will definitely want to keep <path>/usr</path> large: not only
320 will it contain the majority of applications, the Portage tree alone takes
321 more than 500Mb excluding the various sources that are stored in it.
322 </p>
323
324 <p>
325 As you can see, it very much depends on what you want to achieve. Separate
326 partitions or volumes have the following advantages:
327 </p>
328
329 <ul>
330 <li>
331 You can choose the best performing filesystem for each partition or volume
332 </li>
333 <li>
334 Your entire system cannot run out of free space if one defunct tool is
335 continuously writing files to a partition or volume
336 </li>
337 <li>
338 If necessary, file system checks are reduced in time, as multiple checks can
339 be done in parallel (although this advantage is more with multiple disks than
340 it is with multiple partitions)
341 </li>
342 <li>
343 Security can be enhanced by mounting some partitions or volumes read-only,
344 nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
345 </li>
346 </ul>
347
348 <p>
349 However, multiple partitions have one big disadvantage: if not configured
350 properly, you might result in having a system with lots of free space on one
351 partition and none on another. There is also a 15-partition limit for SCSI and
352 SATA.
353 </p>
354
355 </body>
356 </subsection>
357 </section>
358 <section id="mac-fdisk">
359 <title>Default: Using mac-fdisk (Apple) Partition your Disk</title>
360 <body>
361
362 <p>
363 At this point, create your partitions using <c>mac-fdisk</c>:
364 </p>
365
366 <pre caption="Starting mac-fdisk">
367 # <i>mac-fdisk /dev/hda</i>
368 </pre>
369
370 <p>
371 If you used Apple's Disk Utility to leave space for Linux, first delete the
372 partitions you have created previously to make room for your new install. Use
373 <c>d</c> in <c>mac-fdisk</c> to delete those partition(s). It will ask for the
374 partition number to delete. Usually the first partition on NewWorld machines
375 (Apple_partition_map) could not be deleted. If you would like to start with a
376 clean disk, you can simply initialize the disk by pressing <c>i</c>. This
377 will completely erase the disk, so use this with caution.
378 </p>
379
380 <p>
381 Second, create an <e>Apple_Bootstrap</e> partition by using <c>b</c>. It will
382 ask for what block you want to start. Enter the number of your first free
383 partition, followed by a <c>p</c>. For instance this is <c>2p</c>.
384 </p>
385
386 <note>
387 This partition is <e>not</e> a <path>/boot</path> partition. It is not used by
388 Linux at all; you don't have to place any filesystem on it and you should never
389 mount it. Apple users don't need an extra partition for <path>/boot</path>.
390 </note>
391
392 <p>
393 Now create a swap partition by pressing <c>c</c>. Again <c>mac-fdisk</c> will
394 ask for what block you want to start this partition from. As we used <c>2</c>
395 before to create the Apple_Bootstrap partition, you now have to enter
396 <c>3p</c>. When you're asked for the size, enter <c>512M</c> (or whatever size
397 you want -- a minimum of 512MB is recommended, but 2 times your physical memory
398 is the generally accepted size). When asked for a name, enter <c>swap</c>.
399 </p>
400
401 <p>
402 To create the root partition, enter <c>c</c>, followed by <c>4p</c> to select
403 from what block the root partition should start. When asked for the size, enter
404 <c>4p</c> again. <c>mac-fdisk</c> will interpret this as "Use all available
405 space". When asked for the name, enter <c>root</c>.
406 </p>
407
408 <p>
409 To finish up, write the partition to the disk using <c>w</c> and <c>q</c> to
410 quit <c>mac-fdisk</c>.
411 </p>
412
413 <note>
414 To make sure everything is ok, you should run <c>mac-fdisk -l</c> and check
415 whether all the partitions are there. If you don't see any of the partitions
416 you created, or the changes you made, you should reinitialize your partitions
417 by pressing "i" in mac-fdisk. Note that this will recreate the partition map
418 and thus remove all your partitions.
419 </note>
420
421 <p>
422 Now that your partitions are created, you can continue with
423 <uri link="#filesystems">Creating Filesystems</uri>.
424 </p>
425
426 </body>
427 </section>
428 <section id="parted">
429 <title>Using parted to Partition your Disk (Pegasos and RS/6000)</title>
430 <body>
431
432 <p>
433 <c>parted</c>, the Partition Editor, can now handle HFS+ partitions used by
434 Mac OS and Mac OS X. With this tool you can resize your Mac-partitions and
435 create space for your Linux partitions. Nevertheless, the example below
436 describes partitioning for Pegasos machines only.
437 </p>
438
439 <p>
440 To begin let's fire up <c>parted</c>:
441 </p>
442
443 <pre caption="Starting parted">
444 # <i>parted /dev/hda</i>
445 </pre>
446
447 <p>
448 If the drive is unpartitioned, run <c>mklabel amiga</c> to create a new
449 disklabel for the drive.
450 </p>
451
452 <p>
453 You can type <c>print</c> at any time in parted to display the current partition
454 table. If at any time you change your mind or made a mistake you can press
455 <c>Ctrl-c</c> to abort parted.
456 </p>
457
458 <p>
459 If you intend to also install MorphOS on your Pegasos create an affs1 filesystem
460 at the start of the drive. 32MB should be more than enough to store the MorphOS
461 kernel. If you have a Pegasos I or intend to use any filesystem besides ext2 or
462 ext3, you will also have to store your Linux kernel on this partition (the
463 Pegasos II can only boot from ext2/ext3 or affs1 partitions). To create the
464 partition run <c>mkpart primary affs1 START END</c> where <c>START</c> and
465 <c>END</c> should be replaced with the megabyte range (e.g. <c>0 32</c> which
466 creates a 32 MB partition starting at 0MB and ending at 32MB. If you chose to
467 create an ext2 or ext3 partition instead, substitute ext2 or ext3 for affs1 in
468 the mkpart command.
469 </p>
470
471 <p>
472 You will need to create two partitions for Linux, one root filesystem and one
473 swap partition. Run <c>mkpart primary START END</c> to create each partition,
474 replacing <c>START</c> and <c>END</c> with the desired megabyte boundries.
475 </p>
476
477 <p>
478 It is generally recommended that you create a swap partition that is two times
479 bigger than the amount of RAM in your computer, but at least 512Mb is
480 recommended. To create the swap partition, run
481 <c>mkpart primary linux-swap START END</c> with START and END again denoting
482 the partition boundries.
483 </p>
484
485 <p>
486 When you are done in parted simply type <c>quit</c>.
487 </p>
488
489 </body>
490 </section>
491 <section id="filesystems">
492 <title>Creating Filesystems</title>
493 <subsection>
494 <title>Introduction</title>
495 <body>
496
497 <p>
498 Now that your partitions are created, it is time to place a filesystem on them.
499 If you're not sure which filesystems to choose and are happy with our defaults,
500 continue with
501 <uri link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
502 Otherwise, read on to learn about the available filesystems.
503 </p>
504
505 </body>
506 </subsection>
507 <subsection>
508 <title>Filesystems?</title>
509 <body>
510
511 <p>
512 Several filesystems are available for use on the PowerPC architecture including
513 ext2, ext3, ReiserFS and XFS, each with their strengths and faults.
514 </p>
515
516 <p>
517 <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
518 journaling, which means that routine ext2 filesystem checks at startup time can
519 be quite time-consuming. There is now quite a selection of journaled
520 filesystems that can be checked for consistency very quickly and are thus
521 generally preferred over their non-journaled counterparts.
522 </p>
523
524 <p>
525 <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
526 journaling for fast recovery in addition to other enhanced journaling modes
527 like full data and ordered data journaling. It uses a hashed B*-tree index that
528 enables high performance in almost all situations. In short, ext3 is a very
529 good and reliable filesystem and is highly recommended for most installs.
530 </p>
531
532 <p>
533 <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
534 performance and greatly outperforms both ext2 and ext3 when dealing with small
535 files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
536 extremely well and has metadata journaling. ReiserFS is solid and usable as
537 both general-purpose filesystem and for extreme cases such as the creation of
538 large filesystems, very large files and directories containing tens of
539 thousands of small files.
540 </p>
541
542 <p>
543 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
544 feature-set and is optimized for scalability. We only recommend using this
545 filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
546 an uninterruptible power supply. Because XFS aggressively caches in-transit data
547 in RAM, improperly designed programs (those that don't take proper precautions
548 when writing files to disk and there are quite a few of them) can lose a good
549 deal of data if the system goes down unexpectedly.
550 </p>
551
552 </body>
553 </subsection>
554 <subsection>
555 <title>Activating the Swap Partition</title>
556 <body>
557
558 <p>
559 <c>mkswap</c> is the command that is used to initialize swap partitions:
560 </p>
561
562 <pre caption="Creating a swap signature">
563 # <i>mkswap /dev/hda3</i>
564 </pre>
565
566 <p>
567 To activate the swap partition, use <c>swapon</c>:
568 </p>
569
570 <pre caption="Activating the swap partition">
571 # <i>swapon /dev/hda3</i>
572 </pre>
573
574 <p>
575 Create and activate the swap now before creating other filesystems.
576 </p>
577
578 </body>
579 </subsection>
580 <subsection id="filesystems-apply">
581 <title>Applying a Filesystem to a Partition</title>
582 <body>
583
584 <p>
585 To create a filesystem on a partition or volume, there are tools available for
586 each possible filesystem:
587 </p>
588
589 <table>
590 <tr>
591 <th>Filesystem</th>
592 <th>Creation Command</th>
593 </tr>
594 <tr>
595 <ti>ext2</ti>
596 <ti><c>mke2fs</c></ti>
597 </tr>
598 <tr>
599 <ti>ext3</ti>
600 <ti><c>mke2fs -j</c></ti>
601 </tr>
602 <tr>
603 <ti>reiserfs</ti>
604 <ti><c>mkreiserfs</c></ti>
605 </tr>
606 <tr>
607 <ti>xfs</ti>
608 <ti><c>mkfs.xfs</c></ti>
609 </tr>
610 </table>
611
612 <p>
613 For instance, to make an ext3 filesystem on the root partition
614 (<path>/dev/hda4</path> in our example), you would use:
615 </p>
616
617 <pre caption="Applying a filesystem on a partition">
618 # <i>mke2fs -j /dev/hda4</i>
619 </pre>
620
621 <p>
622 Now create the filesystems on your newly created partitions (or logical
623 volumes).
624 </p>
625
626 <note>
627 On the PegasosII your partition which holds the kernel must be ext2, ext3 or
628 affs1. NewWorld machines can boot from any of ext2, ext3, XFS, ReiserFS or
629 even HFS/HFS+ filesystems. On OldWorld machines booting with BootX, the kernel
630 must be placed on an HFS partition, but this will be completed when you
631 configure your bootloader.
632 </note>
633
634 </body>
635 </subsection>
636 </section>
637 <section>
638 <title>Mounting</title>
639 <body>
640
641 <p>
642 Now that your partitions are initialized and are housing a filesystem, it is
643 time to mount those partitions. Use the <c>mount</c> command. As an example we
644 mount the root partition:
645 </p>
646
647 <pre caption="Mounting partitions">
648 # <i>mount /dev/hda4 /mnt/gentoo</i>
649 </pre>
650
651 <note>
652 If you want your <path>/tmp</path> to reside on a separate partition, be sure to
653 change its permissions after mounting and unpacking with
654 <c>chmod 1777 /mnt/gentoo/tmp</c>. This is also true for <path>/var/tmp</path>.
655 </note>
656
657 <p>
658 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
659 Installation Files</uri>.
660 </p>
661
662 </body>
663 </section>
664 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20