/[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.37 - (show annotations) (download) (as text)
Thu Nov 2 20:49:38 2006 UTC (7 years, 10 months ago) by nightmorph
Branch: MAIN
Changes since 1.36: +14 -13 lines
File MIME type: application/xml
Reworded reiserfs and ext3 descriptions for bug 153518

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

  ViewVC Help
Powered by ViewVC 1.1.20