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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.19 - (show annotations) (download) (as text)
Tue Nov 2 11:52:49 2004 UTC (13 years, 1 month ago) by sejo
Branch: MAIN
Changes since 1.18: +15 -3 lines
File MIME type: application/xml
bug 69006

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