/[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.4 - (hide annotations) (download) (as text)
Mon Aug 2 15:54:00 2004 UTC (10 years, 4 months ago) by swift
Branch: MAIN
Changes since 1.3: +4 -10 lines
File MIME type: application/xml
#50289 - Move mounting of /proc right before the chrooting. This also takes care of the errors users receive while unpacking the stage tarballs. Apparently logics is something the crowd wants less

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 swift 1.4 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-mips-disk.xml,v 1.3 2004/07/18 10:29:59 neysx 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 neysx 1.3 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
321     feature-set and is optimized for scalability. We only recommend using this
322     filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
323     an uninterruptible power supply. Because XFS aggressively caches in-transit data
324     in RAM, improperly designed programs (those that don't take proper precautions
325     when writing files to disk and there are quite a few of them) can lose a good
326     deal of data if the system goes down unexpectedly.
327 swift 1.1 </p>
328    
329     <p>
330     <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
331     become production-ready and there hasn't been a sufficient track record to
332     comment positively nor negatively on its general stability at this point.
333     </p>
334    
335     </body>
336     </subsection>
337     <subsection id="filesystems-apply">
338     <title>Applying a Filesystem to a Partition</title>
339     <body>
340    
341     <p>
342     To create a filesystem on a partition or volume, there are tools available for
343     each possible filesystem:
344     </p>
345    
346     <table>
347     <tr>
348     <th>Filesystem</th>
349     <th>Creation Command</th>
350     </tr>
351     <tr>
352     <ti>ext2</ti>
353     <ti><c>mke2fs</c></ti>
354     </tr>
355     <tr>
356     <ti>ext3</ti>
357     <ti><c>mke2fs -j</c></ti>
358     </tr>
359     <tr>
360     <ti>reiserfs</ti>
361     <ti><c>mkreiserfs</c></ti>
362     </tr>
363     <tr>
364     <ti>xfs</ti>
365     <ti><c>mkfs.xfs</c></ti>
366     </tr>
367     <tr>
368     <ti>jfs</ti>
369     <ti><c>mkfs.jfs</c></ti>
370     </tr>
371     </table>
372    
373     <p>
374     For instance, to have the boot partition (<path>/dev/sda1</path> in our
375     example) in ext2 and the root partition (<path>/dev/sda3</path> in our example)
376     in ext3, you would use:
377     </p>
378    
379     <pre caption="Applying a filesystem on a partition">
380     # <i>mke2fs /dev/sda1</i>
381     # <i>mke2fs -j /dev/sda3</i>
382     </pre>
383    
384     <p>
385     Now create the filesystems on your newly created partitions (or logical
386     volumes).
387     </p>
388    
389     </body>
390     </subsection>
391     <subsection>
392     <title>Activating the Swap Partition</title>
393     <body>
394    
395     <p>
396     <c>mkswap</c> is the command that is used to initialize swap partitions:
397     </p>
398    
399     <pre caption="Creating a Swap signature">
400     # <i>mkswap /dev/sda2</i>
401     </pre>
402    
403     <p>
404     To activate the swap partition, use <c>swapon</c>:
405     </p>
406    
407     <pre caption="Activating the swap partition">
408     # <i>swapon /dev/sda2</i>
409     </pre>
410    
411     <p>
412     Create and activate the swap now.
413     </p>
414    
415     </body>
416     </subsection>
417     </section>
418     <section>
419     <title>Mounting</title>
420     <body>
421    
422     <p>
423     Now that your partitions are initialized and are housing a filesystem, it is
424     time to mount those partitions. Use the <c>mount</c> command. Don't forget to
425     create the necessary mount directories for every partition you created. As an
426     example we mount the root and boot partition:
427     </p>
428    
429     <pre caption="Mounting partitions">
430     # <i>mount /dev/sda3 /mnt/gentoo</i>
431     # <i>mkdir /mnt/gentoo/boot</i>
432     # <i>mount /dev/sda1 /mnt/gentoo/boot</i>
433     </pre>
434    
435     <note>
436     If you want your <path>/tmp</path> to reside on a separate partition, be sure to
437     change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
438     also holds for <path>/var/tmp</path>.
439     </note>
440    
441     <p>
442 swift 1.4 We will also have to mount the proc filesystem (a virtual interface with the
443     kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
444 swift 1.1 </p>
445    
446     <p>
447 swift 1.4 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
448 swift 1.1 Installation Files</uri>.
449     </p>
450    
451     </body>
452     </section>
453     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20