/[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.18 - (hide annotations) (download) (as text)
Sun Oct 3 10:14:52 2004 UTC (9 years, 6 months ago) by sejo
Branch: MAIN
Changes since 1.17: +5 -5 lines
File MIME type: application/xml
changes partition map

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

  ViewVC Help
Powered by ViewVC 1.1.20