/[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.6 - (show annotations) (download) (as text)
Tue Sep 14 11:55:12 2004 UTC (10 years ago) by swift
Branch: MAIN
Changes since 1.5: +2 -2 lines
File MIME type: application/xml
#63752 - Add "and SATA" to the 15-partition limit warning

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.5 2004/08/30 17:44:00 neysx 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. There is also a 15-partition
162 limit for SCSI and SATA.
163 </p>
164
165 </body>
166 </subsection>
167 </section>
168 <section id="mac-fdisk">
169 <title>Default: Using mac-fdisk (Apple G5) Partition your Disk</title>
170 <body>
171
172 <p>
173 At this point, create your partitions using <c>mac-fdisk</c>:
174 </p>
175
176 <pre caption="Starting mac-fdisk">
177 # <i>mac-fdisk /dev/sda</i>
178 </pre>
179
180 <p>
181 First delete the partitions you have cleared previously to make room for your
182 Linux partitions. Use <c>d</c> in <c>mac-fdisk</c> to delete those partition(s).
183 It will ask for the partition number to delete.
184 </p>
185
186 <p>
187 Second, create an <e>Apple_Bootstrap</e> partition by using <c>b</c>. It will
188 ask for what block you want to start. Enter the number of your first free
189 partition, followed by a <c>p</c>. For instance this is <c>1p</c>.
190 </p>
191
192 <note>
193 This partition is <e>not</e> a "boot" partition. It is not used by Linux at all;
194 you don't have to place any filesystem on it and you should never mount it. PPC
195 users don't need a an extra partition for <path>/boot</path>.
196 </note>
197
198 <p>
199 Now create a swap partition by pressing <c>c</c>. Again <c>mac-fdisk</c> will
200 ask for what block you want to start this partition from. As we used <c>1</c>
201 before to create the Apple_Bootstrap partition, you now have to enter
202 <c>2p</c>. When you're asked for the size, enter <c>512M</c> (or whatever size
203 you want -- 512MB is recommended though). When asked for a name, enter <c>swap</c>
204 (mandatory).
205 </p>
206
207 <p>
208 To create the root partition, enter <c>c</c>, followed by <c>3p</c> to select
209 from what block the root partition should start. When asked for the size, enter
210 <c>3p</c> again. <c>mac-fdisk</c> will interpret this as "Use all available
211 space". When asked for the name, enter <c>root</c> (mandatory).
212 </p>
213
214 <p>
215 To finish up, write the partition to the disk using <c>w</c> and <c>q</c> to
216 quit <c>mac-fdisk</c>.
217 </p>
218
219 <p>
220 Now that your partitions are created, you can now continue with <uri
221 link="#filesystems">Creating Filesystems</uri>.
222 </p>
223
224 </body>
225 </section>
226 <section id="fdisk">
227 <title>IBM pSeries: using fdisk to Partition your Disk</title>
228 <subsection>
229 <body>
230
231 <p>
232 The following parts explain how to create the example partition layout
233 described previously, namely:
234 </p>
235
236 <table>
237 <tr>
238 <th>Partition</th>
239 <th>Description</th>
240 </tr>
241 <tr>
242 <ti><path>/dev/sda1</path></ti>
243 <ti>PPC PReP Boot partition</ti>
244 </tr>
245 <tr>
246 <ti><path>/dev/sda2</path></ti>
247 <ti>Swap partition</ti>
248 </tr>
249 <tr>
250 <ti><path>/dev/sda3</path></ti>
251 <ti>Root partition</ti>
252 </tr>
253 </table>
254
255 <p>
256 Change your partition layout according to your own preference.
257 </p>
258
259 </body>
260 </subsection>
261 <subsection>
262 <title>Viewing the Current Partition Layout</title>
263 <body>
264
265 <p>
266 <c>fdisk</c> is a popular and powerful tool to split your disk into
267 partitions. Fire up <c>fdisk</c> on your disk (in our example, we
268 use <path>/dev/sda</path>):
269 </p>
270
271 <pre caption="Starting fdisk">
272 # <i>fdisk /dev/sda</i>
273 </pre>
274
275 <p>
276 Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like
277 this:
278 </p>
279
280 <pre caption="fdisk prompt">
281 Command (m for help):
282 </pre>
283
284 <p>
285 Type <c>p</c> to display your disk's current partition configuration:
286 </p>
287
288 <pre caption="An example partition configuration">
289 Command (m for help): p
290
291 Disk /dev/sda: 30.7 GB, 30750031872 bytes
292 141 heads, 63 sectors/track, 6761 cylinders
293 Units = cylinders of 8883 * 512 = 4548096 bytes
294
295 Device Boot Start End Blocks Id System
296 /dev/hdb1 1 12 53266+ 83 Linux
297 /dev/hdb2 13 233 981571+ 82 Linux swap
298 /dev/hdb3 234 674 1958701+ 83 Linux
299 /dev/hdb4 675 6761 27035410+ 5 Extended
300 /dev/hdb5 675 2874 9771268+ 83 Linux
301 /dev/hdb6 2875 2919 199836 83 Linux
302 /dev/hdb7 2920 3008 395262 83 Linux
303 /dev/hdb8 3009 6761 16668918 83 Linux
304
305 Command (m for help):
306 </pre>
307
308 <p>
309 This particular disk is configured to house seven Linux filesystems
310 (each with a corresponding partition listed as "Linux") as well as a
311 swap partition (listed as "Linux swap").
312 </p>
313
314 </body>
315 </subsection>
316 <subsection>
317 <title>Removing all Partitions</title>
318 <body>
319
320 <p>
321 We will first remove all existing partitions from the disk. Type
322 <c>d</c> to delete a partition. For instance, to delete an existing
323 <path>/dev/sda1</path>:
324 </p>
325
326 <note>If you don't want to delete all partitions just delete those you
327 want to delete. At this point the author recommends a backup of your
328 data to avoid the lose of it.
329 </note>
330
331 <pre caption="Deleting a partition">
332 Command (m for help): <i>d</i>
333 Partition number (1-4): <i>1</i>
334 </pre>
335
336 <p>
337 The partition has been scheduled for deletion. It will no longer show up
338 if you type <c>p</c>, but it will not be erased until your changes have
339 been saved. If you made a mistake and want to abort without saving your
340 changes, type <c>q</c> immediately and hit enter and your partition will
341 not be deleted.
342 </p>
343
344 <p>
345 Now, assuming that you do indeed want to wipe out all the partitions on
346 your system, repeatedly type <c>p</c> to print out a partition listing
347 and then type <c>d</c> and the number of the partition to delete it.
348 Eventually, you'll end up with a partition table with nothing in it:
349 </p>
350
351 <pre caption="An empty partition table">
352 Disk /dev/sda: 30.7 GB, 30750031872 bytes
353 141 heads, 63 sectors/track, 6761 cylinders
354 Units = cylinders of 8883 * 512 = 4548096 bytes
355
356 Device Boot Start End Blocks Id System
357
358 Command (m for help):
359 </pre>
360
361 <p>
362 Now that the in-memory partition table is empty, we're ready to create
363 the partitions. We will use a default partitioning scheme as discussed
364 previously. Of course, don't follow these instructions to the letter if
365 you don't want the same partitioning scheme!
366 </p>
367
368 </body>
369 </subsection>
370 <subsection>
371 <title>Creating the PPC PReP boot partition</title>
372 <body>
373
374 <p>
375 We first create a small PReP boot partition. Type <c>n</c> to create a new
376 partition, then <c>p</c> to select a primary partition, followed by
377 <c>1</c> to select the first primary partition. When prompted for the
378 first cylinder, hit enter. When prompted for the last cylinder, type
379 <c>+7M</c> to create a partition 7 Mbyte in size. After you've done
380 this, type <c>t</c> to set the partition type, <c>1</c> to select the
381 partition you just created and then type in <c>41</c> to set the
382 partition type to "PPC PReP Boot".
383 </p>
384
385 <note>
386 The PReP partition has to be smaller than 8 MByte!
387 </note>
388
389 <pre caption="Crating to PReP boot partition">
390 Command (m for help): <i>p</i>
391
392 Disk /dev/sda: 30.7 GB, 30750031872 bytes
393 141 heads, 63 sectors/track, 6761 cylinders
394 Units = cylinders of 8883 * 512 = 4548096 bytes
395
396 Device Boot Start End Blocks Id System
397
398 Command (m for help): <i>n</i>
399 Command action
400 e extended
401 p primary partition (1-4)
402 <i>p</i>
403 Partition number (1-4): <i>1</i>
404 First cylinder (1-6761, default 1):
405 Using default value 1
406 Last cylinder or +size or +sizeM or +sizeK (1-6761, default
407 6761): <i>+8M</i>
408
409 Command (m for help): <i>t</i>
410 Selected partition 1
411 Hex code (type L to list codes): <i>41</i>
412 Changed system type of partition 1 to 41 (PPC PReP Boot)
413
414 Command (m for help):
415 </pre>
416
417 <p>
418 Now, when you type <c>p</c>, you should see the following partition
419 printout:
420 </p>
421
422 <pre caption="Created boot partition">
423 Command (m for help): <i>p</i>
424
425 Disk /dev/sda: 30.7 GB, 30750031872 bytes
426 141 heads, 63 sectors/track, 6761 cylinders
427 Units = cylinders of 8883 * 512 = 4548096 bytes
428
429 Device Boot Start End Blocks Id System
430 /dev/hdb1 1 3 13293 41 PPC PReP Boot
431
432 Command (m for help):
433 </pre>
434 </body>
435 </subsection>
436 <subsection>
437 <title>Creating the Swap Partition</title>
438 <body>
439
440 <p>
441 Let's now create the swap partition. To do this, type <c>n</c> to create
442 a new partition, then <c>p</c> to tell fdisk that you want a primary
443 partition. Then type <c>2</c> to create the second primary partition,
444 <path>/dev/sda2</path> in our case. When prompted for the first
445 cylinder, hit enter. When prompted for the last cylinder, type
446 <c>+512M</c> to create a partition 512MB in size. After you've done
447 this, type <c>t</c> to set the partition type, <c>2</c> to select the
448 partition you just created and then type in <c>82</c> to set the
449 partition type to "Linux Swap". After completing these steps, typing
450 <c>p</c> should display a partition table that looks similar to this:
451 </p>
452
453 <pre caption="Partition listing after creating a swap partition">
454 Command (m for help): <i>p</i>
455
456 Disk /dev/sda: 30.7 GB, 30750031872 bytes
457 141 heads, 63 sectors/track, 6761 cylinders
458 Units = cylinders of 8883 * 512 = 4548096 bytes
459
460 Device Boot Start End Blocks Id System
461 /dev/hdb1 1 3 13293 41 PPC PReP Boot
462 /dev/hdb2 4 117 506331 82 Linux swap
463
464 Command (m for help):
465 </pre>
466
467 </body>
468 </subsection>
469 <subsection>
470 <title>Creating the Root Partition</title>
471 <body>
472
473 <p>
474 Finally, let's create the root partition. To do this, type <c>n</c> to
475 create a new partition, then <c>p</c> to tell fdisk that you want a
476 primary partition. Then type <c>3</c> to create the third primary
477 partition, <path>/dev/sda3</path> in our case. When prompted for the
478 first cylinder, hit enter. When prompted for the last cylinder, hit
479 enter to create a partition that takes up the rest of the remaining
480 space on your disk. After completing these steps, typing <c>p</c> should
481 display a partition table that looks similar to this:
482 </p>
483
484 <pre caption="Partition listing after creating the root partition">
485 Command (m for help): p
486
487 Disk /dev/sda: 30.7 GB, 30750031872 bytes
488 141 heads, 63 sectors/track, 6761 cylinders
489 Units = cylinders of 8883 * 512 = 4548096 bytes
490
491 Device Boot Start End Blocks Id System
492 /dev/hdb1 1 3 13293 41 PPC PReP Boot
493 /dev/hdb2 4 117 506331 82 Linux swap
494 /dev/hdb3 118 6761 29509326 83 Linux
495
496 Command (m for help):
497 </pre>
498 </body>
499 </subsection>
500 <subsection>
501 <title>Saving the Partition Layout</title>
502 <body>
503
504 <p>
505 To save the partition layout and exit <c>fdisk</c>, type <c>w</c>.
506 </p>
507
508 <pre caption="Save and exit fdisk">
509 Command (m for help): <i>w</i>
510 </pre>
511
512 <p>
513 Now that your partitions are created, you can now continue with <uri
514 link="#filesystems">Creating Filesystems</uri>.
515 </p>
516
517 </body>
518 </subsection>
519 <subsection>
520 <title>Filesystems?</title>
521 <body>
522
523 <note>
524 Several filesystems are available. Ext2 and ext3 are found stable on the
525 PPC64 architecture, reiserfs and xfs are in experimental stage. jfs is
526 unsupported.
527 </note>
528
529 <p>
530 <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
531 journaling, which means that routine ext2 filesystem checks at startup time can
532 be quite time-consuming. There is now quite a selection of newer-generation
533 journaled filesystems that can be checked for consistency very quickly and are
534 thus generally preferred over their non-journaled counterparts. Journaled
535 filesystems prevent long delays when you boot your system and your filesystem
536 happens to be in an inconsistent state.
537 </p>
538
539 <p>
540 <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
541 journaling for fast recovery in addition to other enhanced journaling modes like
542 full data and ordered data journaling. ext3 is a very good and reliable
543 filesystem. It has an additional hashed b-tree indexing option that enables
544 high performance in almost all situations. In short, ext3 is an excellent
545 filesystem.
546 </p>
547
548 <p>
549 <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
550 performance and greatly outperforms both ext2 and ext3 when dealing with small
551 files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
552 extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
553 solid and usable as both general-purpose filesystem and for extreme cases such
554 as the creation of large filesystems, the use of many small files, very large
555 files and directories containing tens of thousands of files.
556 </p>
557
558 <p>
559 <b>XFS</b> is a filesystem with metadata journaling that is fully supported
560 under Gentoo Linux's xfs-sources kernel. It comes with a robust feature-set and
561 is optimized for scalability. We only recommend using this filesystem on Linux
562 systems with high-end SCSI and/or fibre channel storage and a uninterruptible
563 power supply. Because XFS aggressively caches in-transit data in RAM, improperly
564 designed programs (those that don't take proper precautions when writing files
565 to disk and there are quite a few of them) can lose a good deal of data if the
566 system goes down unexpectedly.
567 </p>
568
569 <p>
570 <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
571 become production-ready and there hasn't been a sufficient track record to
572 comment positively nor negatively on its general stability at this point.
573 </p>
574
575 </body>
576 </subsection>
577 <subsection id="filesystems-apply">
578 <title>Applying a Filesystem to a Partition</title>
579 <body>
580
581 <p>
582 To create a filesystem on a partition or volume, there are tools available for
583 each possible filesystem:
584 </p>
585
586 <table>
587 <tr>
588 <th>Filesystem</th>
589 <th>Creation Command</th>
590 </tr>
591 <tr>
592 <ti>ext2</ti>
593 <ti><c>mke2fs</c></ti>
594 </tr>
595 <tr>
596 <ti>ext3</ti>
597 <ti><c>mke2fs -j</c></ti>
598 </tr>
599 <tr>
600 <ti>reiserfs</ti>
601 <ti><c>mkreiserfs</c></ti>
602 </tr>
603 <tr>
604 <ti>xfs</ti>
605 <ti><c>mkfs.xfs</c></ti>
606 </tr>
607 <tr>
608 <ti>jfs</ti>
609 <ti><c>mkfs.jfs</c></ti>
610 </tr>
611 </table>
612
613 <p>
614 For instance, to have the root partition (<path>/dev/sda4</path> in our example)
615 in ext3 (as in our example), you would use:
616 </p>
617
618 <pre caption="Applying a filesystem on a partition">
619 # <i>mke2fs -j /dev/sda4</i>
620 </pre>
621
622 <p>
623 Now create the filesystems on your newly created partitions (or logical
624 volumes).
625 </p>
626
627 </body>
628 </subsection>
629 <subsection>
630 <title>Activating the Swap Partition</title>
631 <body>
632
633 <p>
634 <c>mkswap</c> is the command that is used to initialize swap partitions:
635 </p>
636
637 <pre caption="Creating a Swap signature">
638 # <i>mkswap /dev/sda3</i>
639 </pre>
640
641 <p>
642 To activate the swap partition, use <c>swapon</c>:
643 </p>
644
645 <pre caption="Activating the swap partition">
646 # <i>swapon /dev/sda3</i>
647 </pre>
648
649 <p>
650 Create and activate the swap now.
651 </p>
652
653 </body>
654 </subsection>
655 </section>
656 <section>
657 <title>Mounting</title>
658 <body>
659
660 <p>
661 Now that your partitions are initialized and are housing a filesystem, it is
662 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
663 create the necessary mount directories for every partition you created. As an
664 example we create a mount-point and mount the root and boot partition:
665 </p>
666
667 <pre caption="Mounting partitions">
668 # <i>mkdir /mnt/gentoo</i>
669 # <i>mount /dev/sda4 /mnt/gentoo</i>
670 </pre>
671
672 <note>
673 If you want your <path>/tmp</path> to reside on a separate partition, be sure to
674 change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
675 also holds for <path>/var/tmp</path>.
676 </note>
677
678 <p>
679 Finally we have to create the <path>/dev</path> files in our new home, which is
680 needed during the bootloader installation. This could be done by "bind"-mapping
681 the <path>/dev</path>-filesystem from the LiveCD:
682 </p>
683
684 <pre caption="Bind-mounting the /dev-filesystem">
685 # <i>mkdir /mnt/gentoo/dev</i>
686 # <i>mount -o bind /dev /mnt/gentoo/dev</i>
687 </pre>
688
689 <p>
690 We will also have to mount the proc filesystem (a virtual interface with the
691 kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
692 </p>
693
694 <p>
695 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
696 Installation Files</uri>.
697 </p>
698
699 </body>
700 </section>
701 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20