/[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.7 - (hide annotations) (download) (as text)
Wed Apr 28 10:35:05 2004 UTC (10 years, 7 months ago) by bennyc
Branch: MAIN
Changes since 1.6: +2 -2 lines
File MIME type: application/xml
add comma to make it less confusing

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

  ViewVC Help
Powered by ViewVC 1.1.20