/[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.32 - (show annotations) (download) (as text)
Thu Aug 25 19:22:50 2005 UTC (9 years, 1 month ago) by neysx
Branch: MAIN
Changes since 1.31: +3 -10 lines
File MIME type: application/xml
#103723 warning about mount -t ext3 not required anymore

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

  ViewVC Help
Powered by ViewVC 1.1.20