/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-mips-disk.xml
Gentoo

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download) (as text)
Fri Jul 16 09:37:11 2004 UTC (10 years, 5 months ago) by neysx
Branch: MAIN
Changes since 1.1: +2 -2 lines
File MIME type: application/xml
#57267: performant is not proper English

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 neysx 1.2 <!-- $Header: /home/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-mips-disk.xml,v 1.1 2004/04/02 08:14:45 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 SCSI HD in a Linux system, namely
27     <path>/dev/sda</path>.
28     </p>
29    
30     <p>
31     The block devices above represent an abstract interface to the disk. User
32     programs can use these block devices to interact with your disk without worrying
33     about whether your drives are IDE, SCSI or something else. The program can
34     simply address the storage on the disk as a bunch of contiguous,
35     randomly-accessible 512-byte blocks.
36     </p>
37    
38     </body>
39     </subsection>
40     <subsection>
41     <title>Partitions</title>
42     <body>
43    
44     <p>
45     Although it is theoretically possible to use a full disk to house your Linux
46     system, this is almost never done in practice. Instead, full disk block devices
47     are split up in smaller, more manageable block devices. These are called
48     <e>partitions</e>.
49     </p>
50    
51     </body>
52     </subsection>
53     </section>
54     <section>
55     <title>Designing a Partitioning Scheme</title>
56     <subsection>
57     <title>How Many and How Big?</title>
58     <body>
59    
60     <p>
61     The number of partitions is highly dependent on your environment. For instance,
62     if you have lots of users, you will most likely want to have your
63     <path>/home</path> separate as it increases security and makes backups easier.
64     If you are installing Gentoo to perform as a mailserver, your
65     <path>/var</path> should be separate as all mails are stored inside
66     <path>/var</path>. A good choice of filesystem will then maximise your
67     performance. Gameservers will have a separate <path>/opt</path> as most gaming
68     servers are installed there. The reason is similar for <path>/home</path>:
69     security and backups.
70     </p>
71    
72     <p>
73     As you can see, it very much depends on what you want to achieve. Separate
74     partitions or volumes have the following advantages:
75     </p>
76    
77     <ul>
78     <li>
79 neysx 1.2 You can choose the best performing filesystem for each partition or volume
80 swift 1.1 </li>
81     <li>
82     Your entire system cannot run out of free space if one defunct tool is
83     continuously writing files to a partition or volume
84     </li>
85     <li>
86     If necessary, file system checks are reduced in time, as multiple checks can
87     be done in parallel (although this advantage is more with multiple disks than
88     it is with multiple partitions)
89     </li>
90     <li>
91     Security can be enhanced by mounting some partitions or volumes read-only,
92     nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
93     </li>
94     </ul>
95    
96     <p>
97     However, multiple partitions have one big disadvantage: if not configured
98     properly, you might result in having a system with lots
99     of free space on one partition and none on another.
100     </p>
101    
102     </body>
103     </subsection>
104     </section>
105     <section>
106     <title>Using fdisk on MIPS to Partition your Disk</title>
107     <subsection>
108     <title>Creating an SGI Disk Label</title>
109     <body>
110    
111     <p>
112     All disks in an SGI System require an <e>SGI Disk Label</e>, which serves a
113     similar function as Sun &amp; MS-DOS disklabels -- It stores information about
114     the disk partitions. Creating a new SGI Disk Label will create two special
115     partitions on the disk:
116     </p>
117    
118     <ul>
119     <li>
120     <e>SGI Volume Header</e> (9th partition): This partition is important. It
121     is where the kernel images will go. To store kernel images, you will utilize
122     the tool known as <c>dvhtool</c> to copy kernel images to this partition.
123     You will then be able to boot kernels from this partition via the SGI PROM
124     Monitor.
125     </li>
126     <li>
127     <e>SGI Volume</e> (11th partition): This partition is similar in purpose to
128     the Sun Disklabel's third partition of "Whole Disk". This partition spans
129     the entire disk, and should be left untouched. It serves no special purpose
130     other than to assist the PROM in some undocumented fashion (or it is used by
131     IRIX in some way).
132     </li>
133     </ul>
134    
135     <warn>
136     The SGI Volume Header <e>must</e> begin at cylinder 0. Failure to do so means
137     you won't be able to boot from the disk.
138     </warn>
139    
140     <p>
141     The following is an example excerpt from an <c>fdisk</c> session. Read and
142     tailor it to your needs...
143     </p>
144    
145     <pre caption="Creating an SGI Disklabel">
146     # <i>fdisk /dev/sda</i>
147    
148     Command (m for help): <i>x</i>
149    
150     Expert command (m for help): <i>m</i>
151     Command action
152     b move beginning of data in a partition
153     c change number of cylinders
154     d print the raw data in the partition table
155     e list extended partitions
156     f fix partition order
157     g create an IRIX (SGI) partition table
158     h change number of heads
159     m print this menu
160     p print the partition table
161     q quit without saving changes
162     r return to main menu
163     s change number of sectors/track
164     v verify the partition table
165     w write table to disk and exit
166    
167     Expert command (m for help): <i>g</i>
168     Building a new SGI disklabel. Changes will remain in memory only,
169     until you decide to write them. After that, of course, the previous
170     content will be unrecoverably lost.
171    
172     Expert command (m for help): <i>r</i>
173    
174     Command (m for help): <i>p</i>
175    
176     Disk /dev/sda (SGI disk label): 64 heads, 32 sectors, 17482 cylinders
177     Units = cylinders of 2048 * 512 bytes
178    
179     ----- partitions -----
180     Pt# Device Info Start End Sectors Id System
181     9: /dev/sda1 0 4 10240 0 SGI volhdr
182     11: /dev/sda2 0 17481 35803136 6 SGI volume
183     ----- Bootinfo -----
184     Bootfile: /unix
185     ----- Directory Entries -----
186    
187     Command (m for help):
188     </pre>
189    
190     <note>
191     If your disk already has an existing SGI Disklabel, then fdisk will not allow
192     the creation of a new label. There are two ways around this. One is to create a
193     Sun or MS-DOS disklabel, write the changes to disk, and restart fdisk. The
194     second is to overwrite the partition table with null data via the following
195     command: <c>dd if=/dev/zero of=/dev/sda bs=512 count=1</c>.
196     </note>
197    
198     </body>
199     </subsection>
200     <subsection>
201     <title>Getting the SGI Volume Header to just the right size</title>
202     <body>
203    
204     <p>
205     Now that an SGI Disklabel is created, partitions may now be defined. In the
206     above example, there are already two partitions defined for you. These are the
207     special partitions mentioned above and should not normally be altered. However,
208     for installing Gentoo, we'll need to load multiple kernel images directly into
209     the volume header, as there is no supported SGI Bootloader available in Portage
210     yet. The volume header itself can hold up to <e>eight</e> images of any size,
211     with each image allowed eight-character names.
212     </p>
213    
214     <p>
215     The process of making the volume header larger isn't exactly straight-forward --
216     there's a bit of a trick to it. One cannot simply delete and re-add the volume
217     header due to odd fdisk behavior. In the example provided below, we'll create a
218     50MB Volume header in conjunction with a 50MB /boot partition. The actual layout
219     of your disk may vary, but this is for illustrative purposes only.
220     </p>
221    
222     <pre caption="Resizing the SGI Volume Header correctly">
223     Command (m for help): <i>n</i>
224     Partition number (1-16): <i>1</i>
225     First cylinder (5-8682, default 5): <i>51</i>
226     Last cylinder (51-8682, default 8682): <i>101</i>
227     <comment>(Notice how fdisk only allows Partition #1 to be re-created starting at a minimum of cylinder 5)</comment>
228     <comment>(Had you attempted to delete &amp; re-create the SGI Volume Header this way, this is the same issue
229     you would have encountered.)</comment>
230     <comment>(In our example, we want /boot to be 50MB, so we start it at cylinder 51 (the Volume Header needs to
231     start at cylinder 0, remember?), and set its ending cylinder to 101, which will roughly be 50MB (+/- 1-5MB))</comment>
232    
233     Command (m for help): <i>d</i>
234     Partition number (1-16): <i>9</i>
235     <comment>(Delete Partition #9 (SGI Volume Header))</comment>
236    
237     Command (m for help): <i>n</i>
238     Partition number (1-16): <i>9</i>
239     First cylinder (0-50, default 0): <i>0</i>
240     Last cylinder (0-50, default 50): <i>50</i>
241     <comment>(Re-Create Partition #9, ending just before Partition #1)</comment>
242     </pre>
243    
244     </body>
245     </subsection>
246     <subsection>
247     <title>Final partition layout</title>
248     <body>
249    
250     <p>
251     Once this is done, you are safe to create the rest of your partitions as you see
252     fit. After all your partitions are laid out, make sure you set the partition ID
253     of your swap partition to <c>82</c>, which is Linux Swap. By default, it will be
254     <c>83</c>, Linux Native.
255     </p>
256    
257     <p>
258     Now that your partitions are created, you can now continue with <uri
259     link="#filesystems">Creating Filesystems</uri>.
260     </p>
261    
262     </body>
263     </subsection>
264     </section>
265     <section id="filesystems">
266     <title>Creating Filesystems</title>
267     <subsection>
268     <title>Introduction</title>
269     <body>
270    
271     <p>
272     Now that your partitions are created, it is time to place a filesystem on them.
273     If you don't care about what filesystem to choose and are happy with what we use
274     as default in this handbook, continue with <uri
275     link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
276     Otherwise read on to learn about the available filesystems...
277     </p>
278    
279     </body>
280     </subsection>
281     <subsection>
282     <title>Filesystems?</title>
283     <body>
284    
285     <p>
286     Several filesystems are available. Ext2 and ext3 are found stable on the
287     MIPS architectures, others are experimental.
288     </p>
289    
290     <p>
291     <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
292     journaling, which means that routine ext2 filesystem checks at startup time can
293     be quite time-consuming. There is now quite a selection of newer-generation
294     journaled filesystems that can be checked for consistency very quickly and are
295     thus generally preferred over their non-journaled counterparts. Journaled
296     filesystems prevent long delays when you boot your system and your filesystem
297     happens to be in an inconsistent state.
298     </p>
299    
300     <p>
301     <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
302     journaling for fast recovery in addition to other enhanced journaling modes like
303     full data and ordered data journaling. ext3 is a very good and reliable
304     filesystem. It has an additional hashed b-tree indexing option that enables
305     high performance in almost all situations. In short, ext3 is an excellent
306     filesystem.
307     </p>
308    
309     <p>
310     <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
311     performance and greatly outperforms both ext2 and ext3 when dealing with small
312     files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
313     extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
314     solid and usable as both general-purpose filesystem and for extreme cases such
315     as the creation of large filesystems, the use of many small files, very large
316     files and directories containing tens of thousands of files.
317     </p>
318    
319     <p>
320     <b>XFS</b> is a filesystem with metadata journaling that is fully supported
321     under Gentoo Linux's xfs-sources kernel. It comes with a robust feature-set and
322     is optimized for scalability. We only recommend using this filesystem on Linux
323     systems with high-end SCSI and/or fibre channel storage and a uninterruptible
324     power supply. Because XFS aggressively caches in-transit data in RAM, improperly
325     designed programs (those that don't take proper precautions when writing files
326     to disk and there are quite a few of them) can lose a good deal of data if the
327     system goes down unexpectedly.
328     </p>
329    
330     <p>
331     <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
332     become production-ready and there hasn't been a sufficient track record to
333     comment positively nor negatively on its general stability at this point.
334     </p>
335    
336     </body>
337     </subsection>
338     <subsection id="filesystems-apply">
339     <title>Applying a Filesystem to a Partition</title>
340     <body>
341    
342     <p>
343     To create a filesystem on a partition or volume, there are tools available for
344     each possible filesystem:
345     </p>
346    
347     <table>
348     <tr>
349     <th>Filesystem</th>
350     <th>Creation Command</th>
351     </tr>
352     <tr>
353     <ti>ext2</ti>
354     <ti><c>mke2fs</c></ti>
355     </tr>
356     <tr>
357     <ti>ext3</ti>
358     <ti><c>mke2fs -j</c></ti>
359     </tr>
360     <tr>
361     <ti>reiserfs</ti>
362     <ti><c>mkreiserfs</c></ti>
363     </tr>
364     <tr>
365     <ti>xfs</ti>
366     <ti><c>mkfs.xfs</c></ti>
367     </tr>
368     <tr>
369     <ti>jfs</ti>
370     <ti><c>mkfs.jfs</c></ti>
371     </tr>
372     </table>
373    
374     <p>
375     For instance, to have the boot partition (<path>/dev/sda1</path> in our
376     example) in ext2 and the root partition (<path>/dev/sda3</path> in our example)
377     in ext3, you would use:
378     </p>
379    
380     <pre caption="Applying a filesystem on a partition">
381     # <i>mke2fs /dev/sda1</i>
382     # <i>mke2fs -j /dev/sda3</i>
383     </pre>
384    
385     <p>
386     Now create the filesystems on your newly created partitions (or logical
387     volumes).
388     </p>
389    
390     </body>
391     </subsection>
392     <subsection>
393     <title>Activating the Swap Partition</title>
394     <body>
395    
396     <p>
397     <c>mkswap</c> is the command that is used to initialize swap partitions:
398     </p>
399    
400     <pre caption="Creating a Swap signature">
401     # <i>mkswap /dev/sda2</i>
402     </pre>
403    
404     <p>
405     To activate the swap partition, use <c>swapon</c>:
406     </p>
407    
408     <pre caption="Activating the swap partition">
409     # <i>swapon /dev/sda2</i>
410     </pre>
411    
412     <p>
413     Create and activate the swap now.
414     </p>
415    
416     </body>
417     </subsection>
418     </section>
419     <section>
420     <title>Mounting</title>
421     <body>
422    
423     <p>
424     Now that your partitions are initialized and are housing a filesystem, it is
425     time to mount those partitions. Use the <c>mount</c> command. Don't forget to
426     create the necessary mount directories for every partition you created. As an
427     example we mount the root and boot partition:
428     </p>
429    
430     <pre caption="Mounting partitions">
431     # <i>mount /dev/sda3 /mnt/gentoo</i>
432     # <i>mkdir /mnt/gentoo/boot</i>
433     # <i>mount /dev/sda1 /mnt/gentoo/boot</i>
434     </pre>
435    
436     <note>
437     If you want your <path>/tmp</path> to reside on a separate partition, be sure to
438     change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
439     also holds for <path>/var/tmp</path>.
440     </note>
441    
442     <p>
443     We also need to mount the proc filesystem (a virtual interface with the kernel)
444     on <path>/proc</path>. We first create the <path>/mnt/gentoo/proc</path>
445     mountpoint and then mount the filesystem:
446     </p>
447    
448     <pre caption="Creating the /mnt/gentoo/proc mountpoint">
449     # <i>mkdir /mnt/gentoo/proc</i>
450     # <i>mount -t proc none /mnt/gentoo/proc</i>
451     </pre>
452    
453     <p>
454     Now continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
455     Installation Files</uri>.
456     </p>
457    
458     </body>
459     </section>
460     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20