/[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.24 - (show annotations) (download) (as text)
Wed Nov 24 08:37:31 2004 UTC (9 years, 8 months ago) by sejo
Branch: MAIN
Changes since 1.23: +4 -14 lines
File MIME type: application/xml
changes to the handbook

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

  ViewVC Help
Powered by ViewVC 1.1.20