/[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.21 - (show annotations) (download) (as text)
Sun Nov 14 08:35:27 2004 UTC (9 years, 9 months ago) by dertobi123
Branch: MAIN
Changes since 1.20: +12 -7 lines
File MIME type: application/xml
Coding Style

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

  ViewVC Help
Powered by ViewVC 1.1.20