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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download) (as text)
Sun Aug 22 20:58:37 2004 UTC (10 years ago) by neysx
Branch: MAIN
Changes since 1.2: +2 -2 lines
File MIME type: application/xml
s/most performant/best performing/  as we've been told before

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/1.0 -->
6
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-ppc64-disk.xml,v 1.2 2004/08/19 07:58:56 swift Exp $ -->
8
9 <sections>
10 <section>
11 <title>Introduction to Block Devices</title>
12 <subsection>
13 <title>Block Devices</title>
14 <body>
15
16 <p>
17 We'll take a good look at disk-oriented aspects of Gentoo Linux
18 and Linux in general, including Linux filesystems, partitions and block devices.
19 Then, once you're familiar with the ins and outs of disks and filesystems,
20 you'll be guided through the process of setting up partitions and filesystems
21 for your Gentoo Linux installation.
22 </p>
23
24 <p>
25 To begin, we'll introduce <e>block devices</e>. The most famous block device is
26 probably the one that represents the first IDE drive in a Linux system, namely
27 <path>/dev/hda</path>. If your system uses SCSI drives, then your first hard
28 drive would be <path>/dev/sda</path>. Serial ATA drives are also
29 <path>/dev/sda</path> even if they are IDE drives.
30 </p>
31
32 <p>
33 The block devices above represent an abstract interface to the disk. User
34 programs can use these block devices to interact with your disk without worrying
35 about whether your drives are IDE, SCSI or something else. The program can
36 simply address the storage on the disk as a bunch of contiguous,
37 randomly-accessible 512-byte blocks.
38 </p>
39
40 </body>
41 </subsection>
42 <subsection>
43 <title>Partitions and Slices</title>
44 <body>
45
46 <p>
47 Although it is theoretically possible to use a full disk to house your Linux
48 system, this is almost never done in practice. Instead, full disk block devices
49 are split up in smaller, more manageable block devices. On most systems,
50 these are called <e>partitions</e>. Other architectures use a similar technique,
51 called <e>slices</e>.
52 </p>
53
54 </body>
55 </subsection>
56 </section>
57 <section>
58 <title>Designing a Partitioning Scheme</title>
59 <subsection>
60 <title>Default Partitioning Scheme</title>
61 <body>
62
63 <p>
64 If you are not interested in drawing up a partitioning scheme for your system,
65 you can use the partitioning scheme we use throughout this book:
66 </p>
67
68 <table>
69 <tr>
70 <th>Partition</th>
71 <th>Filesystem</th>
72 <th>Size</th>
73 <th>Description</th>
74 </tr>
75 <tr>
76 <ti><path>/dev/sda1</path></ti>
77 <ti>Partition map</ti>
78 <ti>31.5k</ti>
79 <ti>Partition map</ti>
80 </tr>
81 <tr>
82 <ti><path>/dev/sda2</path></ti>
83 <ti>(bootstrap)</ti>
84 <ti>800k</ti>
85 <ti>Apple_Bootstrap</ti>
86 </tr>
87 <tr>
88 <ti><path>/dev/sda3</path></ti>
89 <ti>(swap)</ti>
90 <ti>512M</ti>
91 <ti>Swap partition</ti>
92 </tr>
93 <tr>
94 <ti><path>/dev/sda4</path></ti>
95 <ti>ext3</ti>
96 <ti>Rest of the disk</ti>
97 <ti>Root partition</ti>
98 </tr>
99 </table>
100
101 <note>
102 There are some partitions named like this: <path>Apple_Driver43,
103 Apple_Driver_ATA, Apple_FWDriver, Apple_Driver_IOKit,
104 Apple_Patches</path>. If you are not planning to use MacOS 9 you can
105 delete them, because MacOS X and Linux don't need them.
106 </note>
107
108 <p>
109 If you are interested in knowing how big a partition should be, or even how
110 many partitions you need, read on. Otherwise continue now with
111 <uri link="#mac-fdisk">Apple G5: Using mac-fdisk to Partition your
112 Disk</uri> or <uri link="#fdisk">IBM pSeries: using fdisk to Partition
113 your Disk</uri>
114 </p>
115
116 </body>
117 </subsection>
118 <subsection>
119 <title>How Many and How Big?</title>
120 <body>
121
122 <p>
123 The number of partitions is highly dependent on your environment. For instance,
124 if you have lots of users, you will most likely want to have your
125 <path>/home</path> separate as it increases security and makes backups easier.
126 If you are installing Gentoo to perform as a mailserver, your
127 <path>/var</path> should be separate as all mails are stored inside
128 <path>/var</path>. A good choice of filesystem will then maximise your
129 performance. Gameservers will have a separate <path>/opt</path> as most gaming
130 servers are installed there. The reason is similar for <path>/home</path>:
131 security and backups.
132 </p>
133
134 <p>
135 As you can see, it very much depends on what you want to achieve. Separate
136 partitions or volumes have the following advantages:
137 </p>
138
139 <ul>
140 <li>
141 You can choose the best performing filesystem for each partition or volume
142 </li>
143 <li>
144 Your entire system cannot run out of free space if one defunct tool is
145 continuously writing files to a partition or volume
146 </li>
147 <li>
148 If necessary, file system checks are reduced in time, as multiple checks can
149 be done in parallel (although this advantage is more with multiple disks than
150 it is with multiple partitions)
151 </li>
152 <li>
153 Security can be enhanced by mounting some partitions or volumes read-only,
154 nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
155 </li>
156 </ul>
157
158 <p>
159 However, multiple partitions have one big disadvantage: if not configured
160 properly, you might result in having a system with lots
161 of free space on one partition and none on another.
162 </p>
163
164 </body>
165 </subsection>
166 </section>
167 <section id="mac-fdisk">
168 <title>Default: Using mac-fdisk (Apple G5) Partition your Disk</title>
169 <body>
170
171 <p>
172 At this point, create your partitions using <c>mac-fdisk</c>:
173 </p>
174
175 <pre caption="Starting mac-fdisk">
176 # <i>mac-fdisk /dev/sda</i>
177 </pre>
178
179 <p>
180 First delete the partitions you have cleared previously to make room for your
181 Linux partitions. Use <c>d</c> in <c>mac-fdisk</c> to delete those partition(s).
182 It will ask for the partition number to delete.
183 </p>
184
185 <p>
186 Second, create an <e>Apple_Bootstrap</e> partition by using <c>b</c>. It will
187 ask for what block you want to start. Enter the number of your first free
188 partition, followed by a <c>p</c>. For instance this is <c>1p</c>.
189 </p>
190
191 <note>
192 This partition is <e>not</e> a "boot" partition. It is not used by Linux at all;
193 you don't have to place any filesystem on it and you should never mount it. PPC
194 users don't need a an extra partition for <path>/boot</path>.
195 </note>
196
197 <p>
198 Now create a swap partition by pressing <c>c</c>. Again <c>mac-fdisk</c> will
199 ask for what block you want to start this partition from. As we used <c>1</c>
200 before to create the Apple_Bootstrap partition, you now have to enter
201 <c>2p</c>. When you're asked for the size, enter <c>512M</c> (or whatever size
202 you want -- 512MB is recommended though). When asked for a name, enter <c>swap</c>
203 (mandatory).
204 </p>
205
206 <p>
207 To create the root partition, enter <c>c</c>, followed by <c>3p</c> to select
208 from what block the root partition should start. When asked for the size, enter
209 <c>3p</c> again. <c>mac-fdisk</c> will interpret this as "Use all available
210 space". When asked for the name, enter <c>root</c> (mandatory).
211 </p>
212
213 <p>
214 To finish up, write the partition to the disk using <c>w</c> and <c>q</c> to
215 quit <c>mac-fdisk</c>.
216 </p>
217
218 <p>
219 Now that your partitions are created, you can now continue with <uri
220 link="#filesystems">Creating Filesystems</uri>.
221 </p>
222
223 </body>
224 </section>
225 <section id="fdisk">
226 <title>IBM pSeries: using fdisk to Partition your Disk</title>
227 <subsection>
228 <body>
229
230 <p>
231 The following parts explain how to create the example partition layout
232 described previously, namely:
233 </p>
234
235 <table>
236 <tr>
237 <th>Partition</th>
238 <th>Description</th>
239 </tr>
240 <tr>
241 <ti><path>/dev/sda1</path></ti>
242 <ti>PPC PReP Boot partition</ti>
243 </tr>
244 <tr>
245 <ti><path>/dev/sda2</path></ti>
246 <ti>Swap partition</ti>
247 </tr>
248 <tr>
249 <ti><path>/dev/sda3</path></ti>
250 <ti>Root partition</ti>
251 </tr>
252 </table>
253
254 <p>
255 Change your partition layout according to your own will.
256 </p>
257
258 </body>
259 </subsection>
260 <subsection>
261 <title>Viewing the Current Partition Layout</title>
262 <body>
263
264 <p>
265 <c>fdisk</c> is a popular and powerful tool to split your disk into
266 partitions. Fire up <c>fdisk</c> on your disk (in our example, we
267 use <path>/dev/sda</path>):
268 </p>
269
270 <pre caption="Starting fdisk">
271 # <i>fdisk /dev/sda</i>
272 </pre>
273
274 <p>
275 Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like
276 this:
277 </p>
278
279 <pre caption="fdisk prompt">
280 Command (m for help):
281 </pre>
282
283 <p>
284 Type <c>p</c> to display your disk's current partition configuration:
285 </p>
286
287 <pre caption="An example partition configuration">
288 Command (m for help): p
289
290 Disk /dev/sda: 30.7 GB, 30750031872 bytes
291 141 heads, 63 sectors/track, 6761 cylinders
292 Units = cylinders of 8883 * 512 = 4548096 bytes
293
294 Device Boot Start End Blocks Id System
295 /dev/hdb1 1 12 53266+ 83 Linux
296 /dev/hdb2 13 233 981571+ 82 Linux swap
297 /dev/hdb3 234 674 1958701+ 83 Linux
298 /dev/hdb4 675 6761 27035410+ 5 Extended
299 /dev/hdb5 675 2874 9771268+ 83 Linux
300 /dev/hdb6 2875 2919 199836 83 Linux
301 /dev/hdb7 2920 3008 395262 83 Linux
302 /dev/hdb8 3009 6761 16668918 83 Linux
303
304 Command (m for help):
305 </pre>
306
307 <p>
308 This particular disk is configured to house seven Linux filesystems
309 (each with a corresponding partition listed as "Linux") as well as a
310 swap partition (listed as "Linux swap").
311 </p>
312
313 </body>
314 </subsection>
315 <subsection>
316 <title>Removing all Partitions</title>
317 <body>
318
319 <p>
320 We will first remove all existing partitions from the disk. Type
321 <c>d</c> to delete a partition. For instance, to delete an existing
322 <path>/dev/sda1</path>:
323 </p>
324
325 <note>If you don't want to delete all partitions just delete those you
326 want to delete. At this point the author recommends a backup of your
327 data to avoid the lose of it.
328 </note>
329
330 <pre caption="Deleting a partition">
331 Command (m for help): <i>d</i>
332 Partition number (1-4): <i>1</i>
333 </pre>
334
335 <p>
336 The partition has been scheduled for deletion. It will no longer show up
337 if you type <c>p</c>, but it will not be erased until your changes have
338 been saved. If you made a mistake and want to abort without saving your
339 changes, type <c>q</c> immediately and hit enter and your partition will
340 not be deleted.
341 </p>
342
343 <p>
344 Now, assuming that you do indeed want to wipe out all the partitions on
345 your system, repeatedly type <c>p</c> to print out a partition listing
346 and then type <c>d</c> and the number of the partition to delete it.
347 Eventually, you'll end up with a partition table with nothing in it:
348 </p>
349
350 <pre caption="An empty partition table">
351 Disk /dev/sda: 30.7 GB, 30750031872 bytes
352 141 heads, 63 sectors/track, 6761 cylinders
353 Units = cylinders of 8883 * 512 = 4548096 bytes
354
355 Device Boot Start End Blocks Id System
356
357 Command (m for help):
358 </pre>
359
360 <p>
361 Now that the in-memory partition table is empty, we're ready to create
362 the partitions. We will use a default partitioning scheme as discussed
363 previously. Of course, don't follow these instructions to the letter if
364 you don't want the same partitioning scheme!
365 </p>
366
367 </body>
368 </subsection>
369 <subsection>
370 <title>Creating the PPC PReP boot partition</title>
371 <body>
372
373 <p>
374 We first create a small PReP boot partition. Type <c>n</c> to create a new
375 partition, then <c>p</c> to select a primary partition, followed by
376 <c>1</c> to select the first primary partition. When prompted for the
377 first cylinder, hit enter. When prompted for the last cylinder, type
378 <c>+7M</c> to create a partition 7 Mbyte in size. After you've done
379 this, type <c>t</c> to set the partition type, <c>1</c> to select the
380 partition you just created and then type in <c>41</c> to set the
381 partition type to "PPC PReP Boot".
382 </p>
383
384 <note>
385 The PReP partition has to be smaller than 8 MByte!
386 </note>
387
388 <pre caption="Crating to PReP boot partition">
389 Command (m for help): <i>p</i>
390
391 Disk /dev/sda: 30.7 GB, 30750031872 bytes
392 141 heads, 63 sectors/track, 6761 cylinders
393 Units = cylinders of 8883 * 512 = 4548096 bytes
394
395 Device Boot Start End Blocks Id System
396
397 Command (m for help): <i>n</i>
398 Command action
399 e extended
400 p primary partition (1-4)
401 <i>p</i>
402 Partition number (1-4): <i>1</i>
403 First cylinder (1-6761, default 1):
404 Using default value 1
405 Last cylinder or +size or +sizeM or +sizeK (1-6761, default
406 6761): <i>+8M</i>
407
408 Command (m for help): <i>t</i>
409 Selected partition 1
410 Hex code (type L to list codes): <i>41</i>
411 Changed system type of partition 1 to 41 (PPC PReP Boot)
412
413 Command (m for help):
414 </pre>
415
416 <p>
417 Now, when you type <c>p</c>, you should see the following partition
418 printout:
419 </p>
420
421 <pre caption="Created boot partition">
422 Command (m for help): <i>p</i>
423
424 Disk /dev/sda: 30.7 GB, 30750031872 bytes
425 141 heads, 63 sectors/track, 6761 cylinders
426 Units = cylinders of 8883 * 512 = 4548096 bytes
427
428 Device Boot Start End Blocks Id System
429 /dev/hdb1 1 3 13293 41 PPC PReP Boot
430
431 Command (m for help):
432 </pre>
433 </body>
434 </subsection>
435 <subsection>
436 <title>Creating the Swap Partition</title>
437 <body>
438
439 <p>
440 Let's now create the swap partition. To do this, type <c>n</c> to create
441 a new partition, then <c>p</c> to tell fdisk that you want a primary
442 partition. Then type <c>2</c> to create the second primary partition,
443 <path>/dev/sda2</path> in our case. When prompted for the first
444 cylinder, hit enter. When prompted for the last cylinder, type
445 <c>+512M</c> to create a partition 512MB in size. After you've done
446 this, type <c>t</c> to set the partition type, <c>2</c> to select the
447 partition you just created and then type in <c>82</c> to set the
448 partition type to "Linux Swap". After completing these steps, typing
449 <c>p</c> should display a partition table that looks similar to this:
450 </p>
451
452 <pre caption="Partition listing after creating a swap partition">
453 Command (m for help): <i>p</i>
454
455 Disk /dev/sda: 30.7 GB, 30750031872 bytes
456 141 heads, 63 sectors/track, 6761 cylinders
457 Units = cylinders of 8883 * 512 = 4548096 bytes
458
459 Device Boot Start End Blocks Id System
460 /dev/hdb1 1 3 13293 41 PPC PReP Boot
461 /dev/hdb2 4 117 506331 82 Linux swap
462
463 Command (m for help):
464 </pre>
465
466 </body>
467 </subsection>
468 <subsection>
469 <title>Creating the Root Partition</title>
470 <body>
471
472 <p>
473 Finally, let's create the root partition. To do this, type <c>n</c> to
474 create a new partition, then <c>p</c> to tell fdisk that you want a
475 primary partition. Then type <c>3</c> to create the third primary
476 partition, <path>/dev/sda3</path> in our case. When prompted for the
477 first cylinder, hit enter. When prompted for the last cylinder, hit
478 enter to create a partition that takes up the rest of the remaining
479 space on your disk. After completing these steps, typing <c>p</c> should
480 display a partition table that looks similar to this:
481 </p>
482
483 <pre caption="Partition listing after creating the root partition">
484 Command (m for help): p
485
486 Disk /dev/sda: 30.7 GB, 30750031872 bytes
487 141 heads, 63 sectors/track, 6761 cylinders
488 Units = cylinders of 8883 * 512 = 4548096 bytes
489
490 Device Boot Start End Blocks Id System
491 /dev/hdb1 1 3 13293 41 PPC PReP Boot
492 /dev/hdb2 4 117 506331 82 Linux swap
493 /dev/hdb3 118 6761 29509326 83 Linux
494
495 Command (m for help):
496 </pre>
497 </body>
498 </subsection>
499 <subsection>
500 <title>Saving the Partition Layout</title>
501 <body>
502
503 <p>
504 To save the partition layout and exit <c>fdisk</c>, type <c>w</c>.
505 </p>
506
507 <pre caption="Save and exit fdisk">
508 Command (m for help): <i>w</i>
509 </pre>
510
511 <p>
512 Now that your partitions are created, you can now continue with <uri
513 link="#filesystems">Creating Filesystems</uri>.
514 </p>
515
516 </body>
517 </subsection>
518 <subsection>
519 <title>Filesystems?</title>
520 <body>
521
522 <note>
523 Several filesystems are available. Ext2 and ext3 are found stable on the
524 PPC64 architecture, reiserfs and xfs are in experimental stage. jfs is
525 unsupported.
526 </note>
527
528 <p>
529 <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
530 journaling, which means that routine ext2 filesystem checks at startup time can
531 be quite time-consuming. There is now quite a selection of newer-generation
532 journaled filesystems that can be checked for consistency very quickly and are
533 thus generally preferred over their non-journaled counterparts. Journaled
534 filesystems prevent long delays when you boot your system and your filesystem
535 happens to be in an inconsistent state.
536 </p>
537
538 <p>
539 <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
540 journaling for fast recovery in addition to other enhanced journaling modes like
541 full data and ordered data journaling. ext3 is a very good and reliable
542 filesystem. It has an additional hashed b-tree indexing option that enables
543 high performance in almost all situations. In short, ext3 is an excellent
544 filesystem.
545 </p>
546
547 <p>
548 <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
549 performance and greatly outperforms both ext2 and ext3 when dealing with small
550 files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
551 extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
552 solid and usable as both general-purpose filesystem and for extreme cases such
553 as the creation of large filesystems, the use of many small files, very large
554 files and directories containing tens of thousands of files.
555 </p>
556
557 <p>
558 <b>XFS</b> is a filesystem with metadata journaling that is fully supported
559 under Gentoo Linux's xfs-sources kernel. It comes with a robust feature-set and
560 is optimized for scalability. We only recommend using this filesystem on Linux
561 systems with high-end SCSI and/or fibre channel storage and a uninterruptible
562 power supply. Because XFS aggressively caches in-transit data in RAM, improperly
563 designed programs (those that don't take proper precautions when writing files
564 to disk and there are quite a few of them) can lose a good deal of data if the
565 system goes down unexpectedly.
566 </p>
567
568 <p>
569 <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
570 become production-ready and there hasn't been a sufficient track record to
571 comment positively nor negatively on its general stability at this point.
572 </p>
573
574 </body>
575 </subsection>
576 <subsection id="filesystems-apply">
577 <title>Applying a Filesystem to a Partition</title>
578 <body>
579
580 <p>
581 To create a filesystem on a partition or volume, there are tools available for
582 each possible filesystem:
583 </p>
584
585 <table>
586 <tr>
587 <th>Filesystem</th>
588 <th>Creation Command</th>
589 </tr>
590 <tr>
591 <ti>ext2</ti>
592 <ti><c>mke2fs</c></ti>
593 </tr>
594 <tr>
595 <ti>ext3</ti>
596 <ti><c>mke2fs -j</c></ti>
597 </tr>
598 <tr>
599 <ti>reiserfs</ti>
600 <ti><c>mkreiserfs</c></ti>
601 </tr>
602 <tr>
603 <ti>xfs</ti>
604 <ti><c>mkfs.xfs</c></ti>
605 </tr>
606 <tr>
607 <ti>jfs</ti>
608 <ti><c>mkfs.jfs</c></ti>
609 </tr>
610 </table>
611
612 <p>
613 For instance, to have the root partition (<path>/dev/sda4</path> in our example)
614 in ext3 (as in our example), you would use:
615 </p>
616
617 <pre caption="Applying a filesystem on a partition">
618 # <i>mke2fs -j /dev/sda4</i>
619 </pre>
620
621 <p>
622 Now create the filesystems on your newly created partitions (or logical
623 volumes).
624 </p>
625
626 </body>
627 </subsection>
628 <subsection>
629 <title>Activating the Swap Partition</title>
630 <body>
631
632 <p>
633 <c>mkswap</c> is the command that is used to initialize swap partitions:
634 </p>
635
636 <pre caption="Creating a Swap signature">
637 # <i>mkswap /dev/sda3</i>
638 </pre>
639
640 <p>
641 To activate the swap partition, use <c>swapon</c>:
642 </p>
643
644 <pre caption="Activating the swap partition">
645 # <i>swapon /dev/sda3</i>
646 </pre>
647
648 <p>
649 Create and activate the swap now.
650 </p>
651
652 </body>
653 </subsection>
654 </section>
655 <section>
656 <title>Mounting</title>
657 <body>
658
659 <p>
660 Now that your partitions are initialized and are housing a filesystem, it is
661 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
662 create the necessary mount directories for every partition you created. As an
663 example we create a mount-point and mount the root and boot partition:
664 </p>
665
666 <pre caption="Mounting partitions">
667 # <i>mkdir /mnt/gentoo</i>
668 # <i>mount /dev/sda4 /mnt/gentoo</i>
669 </pre>
670
671 <note>
672 If you want your <path>/tmp</path> to reside on a separate partition, be sure to
673 change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
674 also holds for <path>/var/tmp</path>.
675 </note>
676
677 <p>
678 Finally we have to create the <path>/dev</path> files in our new home, which is
679 needed during the bootloader installation. This could be done by "bind"-mapping
680 the <path>/dev</path>-filesystem from the LiveCD:
681 </p>
682
683 <pre caption="Bind-mounting the /dev-filesystem">
684 # <i>mkdir /mnt/gentoo/dev</i>
685 # <i>mount -o bind /dev /mnt/gentoo/dev</i>
686 </pre>
687
688 <p>
689 We will also have to mount the proc filesystem (a virtual interface with the
690 kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
691 </p>
692
693 <p>
694 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
695 Installation Files</uri>.
696 </p>
697
698 </body>
699 </section>
700 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20