/[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.30 - (show annotations) (download) (as text)
Tue Aug 2 08:03:53 2005 UTC (9 years ago) by swift
Branch: MAIN
Changes since 1.29: +6 -5 lines
File MIME type: application/xml
#101034 - Adding "-O dir_index" information to the guide

Leaving it out of the real example mke2fs command to "stage" it. When we know
more about this b-tree stability and architectural support we can follow the
SPARC handbook and use it by default.

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.29 2005/06/10 18:15:33 swift Exp $ -->
8
9 <sections>
10
11 <version>2.2</version>
12 <date>2005-08-02</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 take 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 famous block device is
30 probably the one that represents the first IDE drive in a Linux system, namely
31 <path>/dev/hda</path>. If your system uses SCSI or SATA drives, then your first
32 hard drive would be <path>/dev/sda</path>.
33 </p>
34
35 <p>
36 The block devices above represent an abstract interface to the disk. User
37 programs can use these block devices to interact with your disk without worrying
38 about whether your drives are IDE, SCSI or something else. The program can
39 simply address the storage on the disk as a bunch of contiguous,
40 randomly-accessible 512-byte blocks.
41 </p>
42
43 </body>
44 </subsection>
45 <subsection>
46 <title>Partitions and Slices</title>
47 <body>
48
49 <p>
50 Although it is theoretically possible to use a full disk to house your Linux
51 system, this is almost never done in practice. Instead, full disk block devices
52 are split up in smaller, more manageable block devices. On most systems,
53 these are called <e>partitions</e>. Other architectures use a similar technique,
54 called <e>slices</e>.
55 </p>
56
57 </body>
58 </subsection>
59 </section>
60 <section>
61 <title>Designing a Partitioning Scheme</title>
62 <subsection>
63 <title>Default Partitioning Scheme</title>
64 <body>
65
66 <p>
67 If you are not interested in drawing up a partitioning scheme for your system,
68 you can use the partitioning scheme we use throughout this book:
69 </p>
70
71 <table>
72 <tr>
73 <th>Partition NewWorld</th>
74 <th>Partition OldWorld</th>
75 <th>Partition Pegasos</th>
76 <th>Partition RS/6000</th>
77 <th>Filesystem</th>
78 <th>Size</th>
79 <th>Description</th>
80 </tr>
81 <tr>
82 <ti><path>/dev/hda1</path></ti>
83 <ti><path>/dev/hda1</path></ti>
84 <ti>(Not applicable)</ti>
85 <ti>(Not applicable)</ti>
86 <ti>(Partition Map)</ti>
87 <ti>32k</ti>
88 <ti>Apple_partition_map</ti>
89 </tr>
90 <tr>
91 <ti><path>/dev/hda2</path></ti>
92 <ti>(Not needed)</ti>
93 <ti>(Not applicable)</ti>
94 <ti>(Not applicable)</ti>
95 <ti>(bootstrap)</ti>
96 <ti>800k</ti>
97 <ti>Apple_Bootstrap</ti>
98 </tr>
99 <tr>
100 <ti>(Not applicable</ti>
101 <ti>(Not applicable)</ti>
102 <ti>(Not applicable)</ti>
103 <ti><path>/dev/sda1</path></ti>
104 <ti>(PReP Boot)</ti>
105 <ti>800k</ti>
106 <ti>Type 0x41</ti>
107 </tr>
108 <tr>
109 <ti>(Not needed)</ti>
110 <ti>(Not needed)</ti>
111 <ti><path>/dev/hda1</path></ti>
112 <ti>(Not needed)</ti>
113 <ti>ext2</ti>
114 <ti>32MB</ti>
115 <ti>Boot partition</ti>
116 </tr>
117 <tr>
118 <ti><path>/dev/hda3</path></ti>
119 <ti><path>/dev/hda2</path></ti>
120 <ti><path>/dev/hda2</path></ti>
121 <ti><path>/dev/sda2</path></ti>
122 <ti>(swap)</ti>
123 <ti>512M</ti>
124 <ti>Swap partition, Type 0x82</ti>
125 </tr>
126 <tr>
127 <ti><path>/dev/hda4</path></ti>
128 <ti><path>/dev/hda3</path></ti>
129 <ti><path>/dev/hda3</path></ti>
130 <ti><path>/dev/sda3</path></ti>
131 <ti>ext3, xfs</ti>
132 <ti>Rest of the disk</ti>
133 <ti>Root partition, Type 0x83</ti>
134 </tr>
135 </table>
136
137 <note>
138 There are some partitions named like this: <path>Apple_Driver43,
139 Apple_Driver_ATA, Apple_FWDriver, Apple_Driver_IOKit, Apple_Patches</path>. If
140 you are not planning to use MacOS 9 you can delete them, because MacOS X and
141 Linux don't need them. You might have to use <c>parted</c> in order to delete
142 them, as mac-fdisk can't delete them yet.
143 </note>
144
145 <warn>
146 <c>parted</c> is able to resize partitions. On the Installation CD there
147 are patches included to resize HFS+ filesystem. Unfortunately it is not
148 possible to resize HFS+ journaled filesystems, even if the journaling has been
149 switchedoff in Mac OS X. Everything you do with resizing in parted you do it
150 on your own risk! Be sure to have a backup of your data!
151 </warn>
152
153 <p>
154 If you are interested in knowing how big a partition should be, or even how many
155 partitions you need, read on. Otherwise continue now with <uri
156 link="#fdisk">Default: Using mac-fdisk (Apple/IBM) to Partition your Disk</uri>
157 or <uri link="#parted">Alternative: Using parted (especially Pegasos) to
158 Partition your Disk</uri>.
159 </p>
160
161 </body>
162 </subsection>
163 <subsection>
164 <title>How Many and How Big?</title>
165 <body>
166
167 <p>
168 The number of partitions is highly dependent on your environment. For instance,
169 if you have lots of users, you will most likely want to have your
170 <path>/home</path> separate as it increases security and makes backups easier.
171 If you are installing Gentoo to perform as a mailserver, your <path>/var</path>
172 should be separate as all mails are stored inside <path>/var</path>. A good
173 choice of filesystem will then maximise your performance. Gameservers will have
174 a separate <path>/opt</path> as most gaming servers are installed there. The
175 reason is similar for <path>/home</path>: security and backups. You will
176 definitely want to keep <path>/usr</path> big: not only will it contain the
177 majority of applications, the Portage tree alone takes around 500 Mbyte
178 excluding the various sources that are stored in it.
179 </p>
180
181 <p>
182 As you can see, it very much depends on what you want to achieve. Separate
183 partitions or volumes have the following advantages:
184 </p>
185
186 <ul>
187 <li>
188 You can choose the best performing filesystem for each partition or volume
189 </li>
190 <li>
191 Your entire system cannot run out of free space if one defunct tool is
192 continuously writing files to a partition or volume
193 </li>
194 <li>
195 If necessary, file system checks are reduced in time, as multiple checks can
196 be done in parallel (although this advantage is more with multiple disks than
197 it is with multiple partitions)
198 </li>
199 <li>
200 Security can be enhanced by mounting some partitions or volumes read-only,
201 nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
202 </li>
203 </ul>
204
205 <p>
206 However, multiple partitions have one big disadvantage: if not configured
207 properly, you might result in having a system with lots of free space on one
208 partition and none on another. There is also a 15-partition limit for SCSI and
209 SATA.
210 </p>
211
212 </body>
213 </subsection>
214 </section>
215 <section id="fdisk">
216 <title>Default: Using mac-fdisk (Apple) Partition your Disk</title>
217 <body>
218
219 <p>
220 At this point, create your partitions using <c>mac-fdisk</c>:
221 </p>
222
223 <pre caption="Starting mac-fdisk">
224 # <i>mac-fdisk /dev/hda</i>
225 </pre>
226
227 <p>
228 First delete the partitions you have cleared previously to make room for your
229 Linux partitions. Use <c>d</c> in <c>mac-fdisk</c> to delete those partition(s).
230 It will ask for the partition number to delete. Usually the first partition on
231 NewWorld machines (Apple_partition_map) could not be deleted.
232 </p>
233
234 <p>
235 Second, create an <e>Apple_Bootstrap</e> partition by using <c>b</c>. It will
236 ask for what block you want to start. Enter the number of your first free
237 partition, followed by a <c>p</c>. For instance this is <c>2p</c>.
238 </p>
239
240 <note>
241 This partition is <e>not</e> a <path>/boot</path> partition. It is not used by
242 Linux at all; you don't have to place any filesystem on it and you should never
243 mount it. Apple users don't need an extra partition for <path>/boot</path>.
244 </note>
245
246 <p>
247 Now create a swap partition by pressing <c>c</c>. Again <c>mac-fdisk</c> will
248 ask for what block you want to start this partition from. As we used <c>2</c>
249 before to create the Apple_Bootstrap partition, you now have to enter
250 <c>3p</c>. When you're asked for the size, enter <c>512M</c> (or whatever size
251 you want -- 512MB is recommended though). When asked for a name, enter <c>swap</c>
252 (mandatory).
253 </p>
254
255 <p>
256 To create the root partition, enter <c>c</c>, followed by <c>4p</c> to select
257 from what block the root partition should start. When asked for the size, enter
258 <c>4p</c> again. <c>mac-fdisk</c> will interpret this as "Use all available
259 space". When asked for the name, enter <c>root</c> (mandatory).
260 </p>
261
262 <p>
263 To finish up, write the partition to the disk using <c>w</c> and <c>q</c> to
264 quit <c>mac-fdisk</c>.
265 </p>
266
267 <note>
268 To make sure everything is ok, you should run mac-fdisk once more and check
269 whether all the partitions are there. If you don't see any of the partitions
270 you created, or the changes you made, you should reinitialize your partitions
271 by pressing "i" in mac-fdisk. Note that this will recreate the partition map
272 and thus remove all your partitions.
273 </note>
274
275 <p>
276 Now that your partitions are created, you can continue with <uri
277 link="#filesystems">Creating Filesystems</uri>.
278 </p>
279
280 </body>
281 </section>
282 <section id="parted">
283 <title>Using parted (especially Pegasos) to Partition your Disk</title>
284 <body>
285
286 <p>
287 <c>parted</c>, the Partition Editor, can now handle HFS+ partitions used by
288 Mac OS and Mac OS X. With this tool you can resize your Mac-partitions and
289 create space for your Linux partitions. Nevertheless, the example below
290 describes partitioning for Pegasos machines only.
291 </p>
292
293 <p>
294 To begin let's fire up <c>parted</c>:
295 </p>
296
297 <pre caption="Starting parted">
298 # <i>parted /dev/hda</i>
299 </pre>
300
301 <p>
302 If the drive is unpartitioned, run <c>mklabel amiga</c> to create a new
303 disklabel for the drive.
304 </p>
305
306 <p>
307 You can type <c>print</c> at any time in parted to display the current partition
308 table. If at any time you change your mind or made a mistake you can press
309 <c>Ctrl-c</c> to abort parted.
310 </p>
311
312 <p>
313 If you intend to also install MorphOS on your Pegasos create an affs1 filesystem
314 named "BI0" (BI zero) at the start of the drive. 32MB should be more than enough
315 to store the MorphOS kernel. If you have a Pegasos I or intend to use reiserfs or
316 xfs, you will also have to store your Linux kernel on this partition (the
317 Pegasos II can only boot from ext2/ext3 or affs1 partitions). To create the partition run
318 <c>mkpart primary affs1 START END</c> where <c>START</c> and <c>END</c> should
319 be replaced with the megabyte range (e.g. <c>0 32</c> creates a 32 MB partition
320 starting at 0MB and ending at 32MB.
321 </p>
322
323 <p>
324 You need to create two partitions for Linux, one root filesystem for all your
325 program files etc, and one swap partition. To create the root filesystem you
326 must first decide which filesystem to use. Possible options are ext2, ext3,
327 reiserfs and xfs. Unless you know what you are doing, use ext3. Run
328 <c>mkpart primary ext3 START END</c> to create an ext3 partition. Again, replace
329 <c>START</c> and <c>END</c> with the megabyte start and stop marks for the
330 partition.
331 </p>
332
333 <p>
334 It is generally recommended that you create a swap partition the same size as
335 the amount of RAM in your computer times two. You will probably get away with a
336 smaller swap partition unless you intend to run a lot of applications at the
337 same time (although at least 512MB is recommended). To create the swap
338 partition, run <c>mkpart primary linux-swap START END</c>.
339 </p>
340
341 <p>
342 Write down the partition minor numbers as they are required during the
343 installation process. To display the minor numbers run <c>print</c>. Your drives
344 are accessed as <path>/dev/hdaX</path> where X is replaced with the minor number
345 of the partition.
346 </p>
347
348 <p>
349 When you are done in parted simply run <c>quit</c>.
350 </p>
351
352 </body>
353 </section>
354 <section id="filesystems">
355 <title>Creating Filesystems</title>
356 <subsection>
357 <title>Introduction</title>
358 <body>
359
360 <p>
361 Now that your partitions are created, it is time to place a filesystem on them.
362 If you don't care about what filesystem to choose and are happy with what we use
363 as default in this handbook, continue with <uri
364 link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
365 Otherwise read on to learn about the available filesystems...
366 </p>
367
368 </body>
369 </subsection>
370 <subsection>
371 <title>Filesystems?</title>
372 <body>
373
374 <p>
375 Several filesystems are available. ext2, ext3 and XFS are found stable on the
376 PPC architecture. jfs is unsupported, ReiserFS still has some problems on ppc
377 and is not supported.
378 </p>
379
380 <p>
381 <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
382 journaling, which means that routine ext2 filesystem checks at startup time can
383 be quite time-consuming. There is now quite a selection of newer-generation
384 journaled filesystems that can be checked for consistency very quickly and are
385 thus generally preferred over their non-journaled counterparts. Journaled
386 filesystems prevent long delays when you boot your system and your filesystem
387 happens to be in an inconsistent state.
388 </p>
389
390 <p>
391 <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
392 journaling for fast recovery in addition to other enhanced journaling modes like
393 full data and ordered data journaling. ext3 is a very good and reliable
394 filesystem. It has an additional hashed b-tree indexing option that enables
395 high performance in almost all situations. You can enable this indexing by
396 adding <c>-O dir_index</c> to the <c>mke2fs</c> command. In short, ext3 is an
397 excellent filesystem.
398 </p>
399
400 <p>
401 <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
402 performance and greatly outperforms both ext2 and ext3 when dealing with small
403 files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
404 extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
405 solid and usable as both general-purpose filesystem and for extreme cases such
406 as the creation of large filesystems, the use of many small files, very large
407 files and directories containing tens of thousands of files. Unfortunately we still have some
408 issues with ReiserFS on ppc. We do not encourage people to use this filesystem.
409 </p>
410
411 <p>
412 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
413 feature-set and is optimized for scalability. We only recommend using this
414 filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
415 an uninterruptible power supply. Because XFS aggressively caches in-transit data
416 in RAM, improperly designed programs (those that don't take proper precautions
417 when writing files to disk and there are quite a few of them) can lose a good
418 deal of data if the system goes down unexpectedly.
419 </p>
420
421 </body>
422 </subsection>
423 <subsection id="filesystems-apply">
424 <title>Applying a Filesystem to a Partition</title>
425 <body>
426
427 <p>
428 To create a filesystem on a partition or volume, there are tools available for
429 each possible filesystem:
430 </p>
431
432 <table>
433 <tr>
434 <th>Filesystem</th>
435 <th>Creation Command</th>
436 </tr>
437 <tr>
438 <ti>ext2</ti>
439 <ti><c>mkfs.ext2</c></ti>
440 </tr>
441 <tr>
442 <ti>ext3</ti>
443 <ti><c>mkfs.ext3</c></ti>
444 </tr>
445 <tr>
446 <ti>reiserfs</ti>
447 <ti><c>mkfs.reiserfs</c></ti>
448 </tr>
449 <tr>
450 <ti>xfs</ti>
451 <ti><c>mkfs.xfs</c></ti>
452 </tr>
453 </table>
454
455 <p>
456 For instance, to have the root partition (<path>/dev/hda4</path> in our example)
457 in ext3 (as in our example), you would use:
458 </p>
459
460 <pre caption="Applying a filesystem on a partition">
461 # <i>mkfs.ext3 /dev/hda4</i>
462 </pre>
463
464 <p>
465 Now create the filesystems on your newly created partitions (or logical
466 volumes).
467 </p>
468
469 <note>
470 On OldWorld machines and the PegasosII your partition which holds the kernel must
471 be ext2 or ext3. NewWorld machines can boot from any of ext2, ext3, XFS,
472 ReiserFS or even HFS/HFS+ filesystems.
473 </note>
474
475 </body>
476 </subsection>
477 <subsection>
478 <title>Activating the Swap Partition</title>
479 <body>
480
481 <p>
482 <c>mkswap</c> is the command that is used to initialize swap partitions:
483 </p>
484
485 <pre caption="Creating a Swap signature">
486 # <i>mkswap /dev/hda3</i>
487 </pre>
488
489 <p>
490 To activate the swap partition, use <c>swapon</c>:
491 </p>
492
493 <pre caption="Activating the swap partition">
494 # <i>swapon /dev/hda3</i>
495 </pre>
496
497 <p>
498 Create and activate the swap now.
499 </p>
500
501 </body>
502 </subsection>
503 </section>
504 <section>
505 <title>Mounting</title>
506 <body>
507
508 <p>
509 Now that your partitions are initialized and are housing a filesystem, it is
510 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
511 create the necessary mount directories for every partition you created. As an
512 example we create a mount-point and mount the root partition:
513 </p>
514
515 <warn>
516 Due to a bug in the e2fsprogs package, you need to explicitly use
517 the <c>mount -t ext3</c> option if you are using an ext3 filesystem.
518 </warn>
519
520 <pre caption="Mounting partitions">
521 # <i>mkdir /mnt/gentoo</i>
522 # <i>mount /dev/hda4 /mnt/gentoo</i>
523 <comment>(For ext3 partitions:)</comment>
524 # <i>mount -t ext3 /dev/hda4 /mnt/gentoo</i>
525 </pre>
526
527 <note>
528 If you want your <path>/tmp</path> to reside on a separate partition, be sure to
529 change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
530 also holds for <path>/var/tmp</path>.
531 </note>
532
533
534 <p>
535 We will have to mount the proc filesystem (a virtual interface with the
536 kernel) on <path>/proc</path>. But first we will need to place our files on the
537 partitions.
538 </p>
539
540 <p>
541 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
542 Installation Files</uri>.
543 </p>
544
545 </body>
546 </section>
547 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20