/[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.28 - (show annotations) (download) (as text)
Mon Mar 28 11:30:52 2005 UTC (9 years, 8 months ago) by swift
Branch: MAIN
Changes since 1.27: +80 -42 lines
File MIME type: application/xml
Updating docos to 2005.0

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/2005.0/hb-install-ppc-disk.xml,v 1.2 2005/03/28 08:20:02 swift Exp $ -->
8
9 <sections>
10
11 <version>2.00</version>
12 <date>2005-03-28</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.
176 </p>
177
178 <p>
179 As you can see, it very much depends on what you want to achieve. Separate
180 partitions or volumes have the following advantages:
181 </p>
182
183 <ul>
184 <li>
185 You can choose the best performing filesystem for each partition or volume
186 </li>
187 <li>
188 Your entire system cannot run out of free space if one defunct tool is
189 continuously writing files to a partition or volume
190 </li>
191 <li>
192 If necessary, file system checks are reduced in time, as multiple checks can
193 be done in parallel (although this advantage is more with multiple disks than
194 it is with multiple partitions)
195 </li>
196 <li>
197 Security can be enhanced by mounting some partitions or volumes read-only,
198 nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
199 </li>
200 </ul>
201
202 <p>
203 However, multiple partitions have one big disadvantage: if not configured
204 properly, you might result in having a system with lots of free space on one
205 partition and none on another. There is also a 15-partition limit for SCSI and
206 SATA.
207 </p>
208
209 </body>
210 </subsection>
211 </section>
212 <section id="fdisk">
213 <title>Default: Using mac-fdisk (Apple) Partition your Disk</title>
214 <body>
215
216 <p>
217 At this point, create your partitions using <c>mac-fdisk</c>:
218 </p>
219
220 <pre caption="Starting mac-fdisk">
221 # <i>mac-fdisk /dev/hda</i>
222 </pre>
223
224 <p>
225 First delete the partitions you have cleared previously to make room for your
226 Linux partitions. Use <c>d</c> in <c>mac-fdisk</c> to delete those partition(s).
227 It will ask for the partition number to delete. Usually the first partition on
228 NewWorld machines (Apple_partition_map) could not be deleted.
229 </p>
230
231 <p>
232 Second, create an <e>Apple_Bootstrap</e> partition by using <c>b</c>. It will
233 ask for what block you want to start. Enter the number of your first free
234 partition, followed by a <c>p</c>. For instance this is <c>2p</c>.
235 </p>
236
237 <note>
238 This partition is <e>not</e> a <path>/boot</path> partition. It is not used by
239 Linux at all; you don't have to place any filesystem on it and you should never
240 mount it. Apple users don't need an extra partition for <path>/boot</path>.
241 </note>
242
243 <p>
244 Now create a swap partition by pressing <c>c</c>. Again <c>mac-fdisk</c> will
245 ask for what block you want to start this partition from. As we used <c>2</c>
246 before to create the Apple_Bootstrap partition, you now have to enter
247 <c>3p</c>. When you're asked for the size, enter <c>512M</c> (or whatever size
248 you want -- 512MB is recommended though). When asked for a name, enter <c>swap</c>
249 (mandatory).
250 </p>
251
252 <p>
253 To create the root partition, enter <c>c</c>, followed by <c>4p</c> to select
254 from what block the root partition should start. When asked for the size, enter
255 <c>4p</c> again. <c>mac-fdisk</c> will interpret this as "Use all available
256 space". When asked for the name, enter <c>root</c> (mandatory).
257 </p>
258
259 <p>
260 To finish up, write the partition to the disk using <c>w</c> and <c>q</c> to
261 quit <c>mac-fdisk</c>.
262 </p>
263
264 <note>
265 To make sure everything is ok, you should run mac-fdisk once more and check
266 whether all the partitions are there. If you don't see any of the partitions
267 you created, or the changes you made, you should reinitialize your partitions
268 by pressing "i" in mac-fdisk. Note that this will recreate the partition map
269 and thus remove all your partitions.
270 </note>
271
272 <p>
273 Now that your partitions are created, you can continue with <uri
274 link="#filesystems">Creating Filesystems</uri>.
275 </p>
276
277 </body>
278 </section>
279 <section id="parted">
280 <title>Using parted (especially Pegasos) to Partition your Disk</title>
281 <body>
282
283 <p>
284 <c>parted</c>, the Partition Editor, can now handle HFS+ partitions used by
285 Mac OS and Mac OS X. With this tool you can resize your Mac-partitions and
286 create space for your Linux partitions. Nevertheless, the example below
287 describes partitioning for Pegasos machines only.
288 </p>
289
290 <p>
291 To begin let's fire up <c>parted</c>:
292 </p>
293
294 <pre caption="Starting parted">
295 # <i>parted /dev/hda</i>
296 </pre>
297
298 <p>
299 If the drive is unpartitioned, run <c>mklabel amiga</c> to create a new
300 disklabel for the drive.
301 </p>
302
303 <p>
304 You can type <c>print</c> at any time in parted to display the current partition
305 table. If at any time you change your mind or made a mistake you can press
306 <c>Ctrl-c</c> to abort parted.
307 </p>
308
309 <p>
310 If you intend to also install MorphOS on your Pegasos create an affs1 filesystem
311 named "BI0" (BI zero) at the start of the drive. 32MB should be more than enough
312 to store the MorphOS kernel. If you have a Pegasos I or intend to use reiserfs or
313 xfs, you will also have to store your Linux kernel on this partition (the
314 Pegasos II can only boot from ext2/ext3 or affs1 partitions). To create the partition run
315 <c>mkpart primary affs1 START END</c> where <c>START</c> and <c>END</c> should
316 be replaced with the megabyte range (e.g. <c>0 32</c> creates a 32 MB partition
317 starting at 0MB and ending at 32MB.
318 </p>
319
320 <p>
321 You need to create two partitions for Linux, one root filesystem for all your
322 program files etc, and one swap partition. To create the root filesystem you
323 must first decide which filesystem to use. Possible options are ext2, ext3,
324 reiserfs and xfs. Unless you know what you are doing, use ext3. Run
325 <c>mkpart primary ext3 START END</c> to create an ext3 partition. Again, replace
326 <c>START</c> and <c>END</c> with the megabyte start and stop marks for the
327 partition.
328 </p>
329
330 <p>
331 It is generally recommended that you create a swap partition the same size as
332 the amount of RAM in your computer times two. You will probably get away with a
333 smaller swap partition unless you intend to run a lot of applications at the
334 same time (although at least 512MB is recommended). To create the swap
335 partition, run <c>mkpart primary linux-swap START END</c>.
336 </p>
337
338 <p>
339 Write down the partition minor numbers as they are required during the
340 installation process. To display the minor numbers run <c>print</c>. Your drives
341 are accessed as <path>/dev/hdaX</path> where X is replaced with the minor number
342 of the partition.
343 </p>
344
345 <p>
346 When you are done in parted simply run <c>quit</c>.
347 </p>
348
349 </body>
350 </section>
351 <section id="filesystems">
352 <title>Creating Filesystems</title>
353 <subsection>
354 <title>Introduction</title>
355 <body>
356
357 <p>
358 Now that your partitions are created, it is time to place a filesystem on them.
359 If you don't care about what filesystem to choose and are happy with what we use
360 as default in this handbook, continue with <uri
361 link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
362 Otherwise read on to learn about the available filesystems...
363 </p>
364
365 </body>
366 </subsection>
367 <subsection>
368 <title>Filesystems?</title>
369 <body>
370
371 <p>
372 Several filesystems are available. ext2, ext3 and XFS are found stable on the
373 PPC architecture. jfs is unsupported, ReiserFS still has some problems on ppc
374 and is not supported.
375 </p>
376
377 <p>
378 <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
379 journaling, which means that routine ext2 filesystem checks at startup time can
380 be quite time-consuming. There is now quite a selection of newer-generation
381 journaled filesystems that can be checked for consistency very quickly and are
382 thus generally preferred over their non-journaled counterparts. Journaled
383 filesystems prevent long delays when you boot your system and your filesystem
384 happens to be in an inconsistent state.
385 </p>
386
387 <p>
388 <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
389 journaling for fast recovery in addition to other enhanced journaling modes like
390 full data and ordered data journaling. ext3 is a very good and reliable
391 filesystem. It has an additional hashed b-tree indexing option that enables
392 high performance in almost all situations. In short, ext3 is an excellent
393 filesystem.
394 </p>
395
396 <p>
397 <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
398 performance and greatly outperforms both ext2 and ext3 when dealing with small
399 files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
400 extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
401 solid and usable as both general-purpose filesystem and for extreme cases such
402 as the creation of large filesystems, the use of many small files, very large
403 files and directories containing tens of thousands of files. Unfortunately we still have some
404 issues with ReiserFS on ppc. We do not encourage people to use this filesystem.
405 </p>
406
407 <p>
408 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
409 feature-set and is optimized for scalability. We only recommend using this
410 filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
411 an uninterruptible power supply. Because XFS aggressively caches in-transit data
412 in RAM, improperly designed programs (those that don't take proper precautions
413 when writing files to disk and there are quite a few of them) can lose a good
414 deal of data if the system goes down unexpectedly.
415 </p>
416
417 </body>
418 </subsection>
419 <subsection id="filesystems-apply">
420 <title>Applying a Filesystem to a Partition</title>
421 <body>
422
423 <p>
424 To create a filesystem on a partition or volume, there are tools available for
425 each possible filesystem:
426 </p>
427
428 <table>
429 <tr>
430 <th>Filesystem</th>
431 <th>Creation Command</th>
432 </tr>
433 <tr>
434 <ti>ext2</ti>
435 <ti><c>mkfs.ext2</c></ti>
436 </tr>
437 <tr>
438 <ti>ext3</ti>
439 <ti><c>mkfs.ext3</c></ti>
440 </tr>
441 <tr>
442 <ti>reiserfs</ti>
443 <ti><c>mkfs.reiserfs</c></ti>
444 </tr>
445 <tr>
446 <ti>xfs</ti>
447 <ti><c>mkfs.xfs</c></ti>
448 </tr>
449 </table>
450
451 <p>
452 For instance, to have the root partition (<path>/dev/hda4</path> in our example)
453 in ext3 (as in our example), you would use:
454 </p>
455
456 <pre caption="Applying a filesystem on a partition">
457 # <i>mkfs.ext3 /dev/hda4</i>
458 </pre>
459
460 <p>
461 Now create the filesystems on your newly created partitions (or logical
462 volumes).
463 </p>
464
465 <note>
466 On OldWorld machines and the PegasosII your partition which holds the kernel must
467 be ext2 or ext3. NewWorld machines can boot from any of ext2, ext3, XFS,
468 ReiserFS or even HFS/HFS+ filesystems.
469 </note>
470
471 </body>
472 </subsection>
473 <subsection>
474 <title>Activating the Swap Partition</title>
475 <body>
476
477 <p>
478 <c>mkswap</c> is the command that is used to initialize swap partitions:
479 </p>
480
481 <pre caption="Creating a Swap signature">
482 # <i>mkswap /dev/hda3</i>
483 </pre>
484
485 <p>
486 To activate the swap partition, use <c>swapon</c>:
487 </p>
488
489 <pre caption="Activating the swap partition">
490 # <i>swapon /dev/hda3</i>
491 </pre>
492
493 <p>
494 Create and activate the swap now.
495 </p>
496
497 </body>
498 </subsection>
499 </section>
500 <section>
501 <title>Mounting</title>
502 <body>
503
504 <p>
505 Now that your partitions are initialized and are housing a filesystem, it is
506 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
507 create the necessary mount directories for every partition you created. As an
508 example we create a mount-point and mount the root partition:
509 </p>
510
511 <warn>
512 Due to a bug in the e2fsprogs package, you need to explicitly use
513 the <c>mount -t ext3</c> option if you are using an ext3 filesystem.
514 </warn>
515
516 <pre caption="Mounting partitions">
517 # <i>mkdir /mnt/gentoo</i>
518 # <i>mount /dev/hda4 /mnt/gentoo</i>
519 <comment>(For ext3 partitions:)</comment>
520 # <i>mount -t ext3 /dev/hda4 /mnt/gentoo</i>
521 </pre>
522
523 <note>
524 If you want your <path>/tmp</path> to reside on a separate partition, be sure to
525 change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
526 also holds for <path>/var/tmp</path>.
527 </note>
528
529
530 <p>
531 We will have to mount the proc filesystem (a virtual interface with the
532 kernel) on <path>/proc</path>. But first we will need to place our files on the
533 partitions.
534 </p>
535
536 <p>
537 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
538 Installation Files</uri>.
539 </p>
540
541 </body>
542 </section>
543 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20