/[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.40 - (show annotations) (download) (as text)
Tue May 8 23:38:19 2007 UTC (7 years, 5 months ago) by nightmorph
Branch: MAIN
Changes since 1.39: +3 -3 lines
File MIME type: application/xml
typo fix, no content change

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

  ViewVC Help
Powered by ViewVC 1.1.20