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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.34 - (show annotations) (download) (as text)
Mon Feb 27 00:55:34 2006 UTC (12 years, 10 months ago) by fox2mike
Branch: MAIN
Changes since 1.33: +16 -18 lines
File MIME type: application/xml
Handbook for 2006.0, "Chuck Norris can divide by zero"

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

  ViewVC Help
Powered by ViewVC 1.1.20