Contents of /xml/htdocs/doc/en/handbook/hb-install-ppc-disk.xml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.25 - (show annotations) (download) (as text)
Sun Dec 12 11:10:46 2004 UTC (14 years ago) by sejo
Branch: MAIN
Changes since 1.24: +7 -6 lines
File MIME type: application/xml
changed some things to the ppc docs

1 <?xml version='1.0' encoding='UTF-8'?>
2 <!DOCTYPE sections SYSTEM "/dtd/book.dtd">
4 <!-- The content of this document is licensed under the CC-BY-SA license -->
5 <!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-ppc-disk.xml,v 1.24 2004/11/24 08:37:31 sejo Exp $ -->
9 <sections>
11 <version>1.21</version>
12 <date>2004-12-12</date>
14 <section>
15 <title>Introduction to Block Devices</title>
16 <subsection>
17 <title>Block Devices</title>
18 <body>
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>
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>
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>
43 </body>
44 </subsection>
45 <subsection>
46 <title>Partitions and Slices</title>
47 <body>
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>
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>
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>
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>
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>
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>
130 </body>
131 </subsection>
132 <subsection>
133 <title>How Many and How Big?</title>
134 <body>
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>
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>
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>
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>
178 </body>
179 </subsection>
180 </section>
181 <section id="fdisk">
182 <title>Default: Using mac-fdisk (Apple/IBM) Partition your Disk</title>
183 <body>
185 <p>
186 At this point, create your partitions using <c>mac-fdisk</c>:
187 </p>
189 <pre caption="Starting mac-fdisk">
190 # <i>mac-fdisk /dev/hda</i>
191 </pre>
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>
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>
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>
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>
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>
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>
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>
241 <p>
242 Now that your partitions are created, you can continue with <uri
243 link="#filesystems">Creating Filesystems</uri>.
244 </p>
246 </body>
247 </section>
248 <section id="parted">
249 <title>Using parted (especially Pegasos) to Partition your Disk</title>
250 <body>
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>
259 <p>
260 To begin let's fire up <c>parted</c>:
261 </p>
263 <pre caption="Starting parted">
264 # <i>parted /dev/hda</i>
265 </pre>
267 <p>
268 If the drive is unpartitioned, run <c>mklabel amiga</c> to create a new
269 disklabel for the drive.
270 </p>
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>
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>
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>
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>
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>
315 <p>
316 When you are done in parted simply run <c>quit</c>.
317 </p>
319 </body>
320 </section>
321 <section id="filesystems">
322 <title>Creating Filesystems</title>
323 <subsection>
324 <title>Introduction</title>
325 <body>
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>
335 </body>
336 </subsection>
337 <subsection>
338 <title>Filesystems?</title>
339 <body>
341 <p>
342 Several filesystems are available. ext2, ext3 and XFS are found stable
343 on the PPC architecture. jfs is unsupported, ReiserFS still has some problems on ppc and is not supported.
344 </p>
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>
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>
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. Unfortunately we still have some
373 issues with ReiserFS on ppc. We do not encourage people to use this filesystem.
374 </p>
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>
386 </body>
387 </subsection>
388 <subsection id="filesystems-apply">
389 <title>Applying a Filesystem to a Partition</title>
390 <body>
392 <p>
393 To create a filesystem on a partition or volume, there are tools available for
394 each possible filesystem:
395 </p>
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>
420 <p>
421 For instance, to have the root partition (<path>/dev/hda4</path> in our example)
422 in ext3 (as in our example), you would use:
423 </p>
425 <pre caption="Applying a filesystem on a partition">
426 # <i>mke2fs -j /dev/hda4</i>
427 </pre>
429 <p>
430 Now create the filesystems on your newly created partitions (or logical
431 volumes).
432 </p>
434 <note>
435 On OldWorld machines and the PegasosII your partition which holds the kernel must
436 be ext2 or ext3. NewWorld machines can boot from any of ext2, ext3, XFS,
437 ReiserFS or even HFS/HFS+ filesystems.
438 </note>
440 </body>
441 </subsection>
442 <subsection>
443 <title>Activating the Swap Partition</title>
444 <body>
446 <p>
447 <c>mkswap</c> is the command that is used to initialize swap partitions:
448 </p>
450 <pre caption="Creating a Swap signature">
451 # <i>mkswap /dev/hda3</i>
452 </pre>
454 <p>
455 To activate the swap partition, use <c>swapon</c>:
456 </p>
458 <pre caption="Activating the swap partition">
459 # <i>swapon /dev/hda3</i>
460 </pre>
462 <p>
463 Create and activate the swap now.
464 </p>
466 </body>
467 </subsection>
468 </section>
469 <section>
470 <title>Mounting</title>
471 <body>
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 partition:
478 </p>
480 <pre caption="Mounting partitions">
481 # <i>mkdir /mnt/gentoo</i>
482 # <i>mount /dev/hda4 /mnt/gentoo</i>
483 </pre>
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>
492 <p>
493 We will have to mount the proc filesystem (a virtual interface with the
494 kernel) on <path>/proc</path>. But first we will need to place our files on the
495 partitions.
496 </p>
498 <p>
499 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
500 Installation Files</uri>.
501 </p>
503 </body>
504 </section>
505 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20