/[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.6 - (hide annotations) (download) (as text)
Tue Sep 14 11:55:12 2004 UTC (9 years, 10 months ago) by swift
Branch: MAIN
Changes since 1.5: +2 -2 lines
File MIME type: application/xml
#63752 - Add "and SATA" to the 15-partition limit warning

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.6 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-mips-disk.xml,v 1.5 2004/08/29 12:17:07 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 swift 1.5 of free space on one partition and none on another. There is also a 15-partition
100 swift 1.6 limit for SCSI and SATA.
101 swift 1.1 </p>
102    
103     </body>
104     </subsection>
105     </section>
106     <section>
107     <title>Using fdisk on MIPS to Partition your Disk</title>
108     <subsection>
109     <title>Creating an SGI Disk Label</title>
110     <body>
111    
112     <p>
113     All disks in an SGI System require an <e>SGI Disk Label</e>, which serves a
114     similar function as Sun &amp; MS-DOS disklabels -- It stores information about
115     the disk partitions. Creating a new SGI Disk Label will create two special
116     partitions on the disk:
117     </p>
118    
119     <ul>
120     <li>
121     <e>SGI Volume Header</e> (9th partition): This partition is important. It
122     is where the kernel images will go. To store kernel images, you will utilize
123     the tool known as <c>dvhtool</c> to copy kernel images to this partition.
124     You will then be able to boot kernels from this partition via the SGI PROM
125     Monitor.
126     </li>
127     <li>
128     <e>SGI Volume</e> (11th partition): This partition is similar in purpose to
129     the Sun Disklabel's third partition of "Whole Disk". This partition spans
130     the entire disk, and should be left untouched. It serves no special purpose
131     other than to assist the PROM in some undocumented fashion (or it is used by
132     IRIX in some way).
133     </li>
134     </ul>
135    
136     <warn>
137     The SGI Volume Header <e>must</e> begin at cylinder 0. Failure to do so means
138     you won't be able to boot from the disk.
139     </warn>
140    
141     <p>
142     The following is an example excerpt from an <c>fdisk</c> session. Read and
143     tailor it to your needs...
144     </p>
145    
146     <pre caption="Creating an SGI Disklabel">
147     # <i>fdisk /dev/sda</i>
148    
149     Command (m for help): <i>x</i>
150    
151     Expert command (m for help): <i>m</i>
152     Command action
153     b move beginning of data in a partition
154     c change number of cylinders
155     d print the raw data in the partition table
156     e list extended partitions
157     f fix partition order
158     g create an IRIX (SGI) partition table
159     h change number of heads
160     m print this menu
161     p print the partition table
162     q quit without saving changes
163     r return to main menu
164     s change number of sectors/track
165     v verify the partition table
166     w write table to disk and exit
167    
168     Expert command (m for help): <i>g</i>
169     Building a new SGI disklabel. Changes will remain in memory only,
170     until you decide to write them. After that, of course, the previous
171     content will be unrecoverably lost.
172    
173     Expert command (m for help): <i>r</i>
174    
175     Command (m for help): <i>p</i>
176    
177     Disk /dev/sda (SGI disk label): 64 heads, 32 sectors, 17482 cylinders
178     Units = cylinders of 2048 * 512 bytes
179    
180     ----- partitions -----
181     Pt# Device Info Start End Sectors Id System
182     9: /dev/sda1 0 4 10240 0 SGI volhdr
183     11: /dev/sda2 0 17481 35803136 6 SGI volume
184     ----- Bootinfo -----
185     Bootfile: /unix
186     ----- Directory Entries -----
187    
188     Command (m for help):
189     </pre>
190    
191     <note>
192     If your disk already has an existing SGI Disklabel, then fdisk will not allow
193     the creation of a new label. There are two ways around this. One is to create a
194     Sun or MS-DOS disklabel, write the changes to disk, and restart fdisk. The
195     second is to overwrite the partition table with null data via the following
196     command: <c>dd if=/dev/zero of=/dev/sda bs=512 count=1</c>.
197     </note>
198    
199     </body>
200     </subsection>
201     <subsection>
202     <title>Getting the SGI Volume Header to just the right size</title>
203     <body>
204    
205     <p>
206     Now that an SGI Disklabel is created, partitions may now be defined. In the
207     above example, there are already two partitions defined for you. These are the
208     special partitions mentioned above and should not normally be altered. However,
209     for installing Gentoo, we'll need to load multiple kernel images directly into
210     the volume header, as there is no supported SGI Bootloader available in Portage
211     yet. The volume header itself can hold up to <e>eight</e> images of any size,
212     with each image allowed eight-character names.
213     </p>
214    
215     <p>
216     The process of making the volume header larger isn't exactly straight-forward --
217     there's a bit of a trick to it. One cannot simply delete and re-add the volume
218     header due to odd fdisk behavior. In the example provided below, we'll create a
219     50MB Volume header in conjunction with a 50MB /boot partition. The actual layout
220     of your disk may vary, but this is for illustrative purposes only.
221     </p>
222    
223     <pre caption="Resizing the SGI Volume Header correctly">
224     Command (m for help): <i>n</i>
225     Partition number (1-16): <i>1</i>
226     First cylinder (5-8682, default 5): <i>51</i>
227     Last cylinder (51-8682, default 8682): <i>101</i>
228     <comment>(Notice how fdisk only allows Partition #1 to be re-created starting at a minimum of cylinder 5)</comment>
229     <comment>(Had you attempted to delete &amp; re-create the SGI Volume Header this way, this is the same issue
230     you would have encountered.)</comment>
231     <comment>(In our example, we want /boot to be 50MB, so we start it at cylinder 51 (the Volume Header needs to
232     start at cylinder 0, remember?), and set its ending cylinder to 101, which will roughly be 50MB (+/- 1-5MB))</comment>
233    
234     Command (m for help): <i>d</i>
235     Partition number (1-16): <i>9</i>
236     <comment>(Delete Partition #9 (SGI Volume Header))</comment>
237    
238     Command (m for help): <i>n</i>
239     Partition number (1-16): <i>9</i>
240     First cylinder (0-50, default 0): <i>0</i>
241     Last cylinder (0-50, default 50): <i>50</i>
242     <comment>(Re-Create Partition #9, ending just before Partition #1)</comment>
243     </pre>
244    
245     </body>
246     </subsection>
247     <subsection>
248     <title>Final partition layout</title>
249     <body>
250    
251     <p>
252     Once this is done, you are safe to create the rest of your partitions as you see
253     fit. After all your partitions are laid out, make sure you set the partition ID
254     of your swap partition to <c>82</c>, which is Linux Swap. By default, it will be
255     <c>83</c>, Linux Native.
256     </p>
257    
258     <p>
259     Now that your partitions are created, you can now continue with <uri
260     link="#filesystems">Creating Filesystems</uri>.
261     </p>
262    
263     </body>
264     </subsection>
265     </section>
266     <section id="filesystems">
267     <title>Creating Filesystems</title>
268     <subsection>
269     <title>Introduction</title>
270     <body>
271    
272     <p>
273     Now that your partitions are created, it is time to place a filesystem on them.
274     If you don't care about what filesystem to choose and are happy with what we use
275     as default in this handbook, continue with <uri
276     link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
277     Otherwise read on to learn about the available filesystems...
278     </p>
279    
280     </body>
281     </subsection>
282     <subsection>
283     <title>Filesystems?</title>
284     <body>
285    
286     <p>
287     Several filesystems are available. Ext2 and ext3 are found stable on the
288     MIPS architectures, others are experimental.
289     </p>
290    
291     <p>
292     <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
293     journaling, which means that routine ext2 filesystem checks at startup time can
294     be quite time-consuming. There is now quite a selection of newer-generation
295     journaled filesystems that can be checked for consistency very quickly and are
296     thus generally preferred over their non-journaled counterparts. Journaled
297     filesystems prevent long delays when you boot your system and your filesystem
298     happens to be in an inconsistent state.
299     </p>
300    
301     <p>
302     <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
303     journaling for fast recovery in addition to other enhanced journaling modes like
304     full data and ordered data journaling. ext3 is a very good and reliable
305     filesystem. It has an additional hashed b-tree indexing option that enables
306     high performance in almost all situations. In short, ext3 is an excellent
307     filesystem.
308     </p>
309    
310     <p>
311     <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
312     performance and greatly outperforms both ext2 and ext3 when dealing with small
313     files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
314     extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
315     solid and usable as both general-purpose filesystem and for extreme cases such
316     as the creation of large filesystems, the use of many small files, very large
317     files and directories containing tens of thousands of files.
318     </p>
319    
320     <p>
321 neysx 1.3 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
322     feature-set and is optimized for scalability. We only recommend using this
323     filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
324     an uninterruptible power supply. Because XFS aggressively caches in-transit data
325     in RAM, improperly designed programs (those that don't take proper precautions
326     when writing files to disk and there are quite a few of them) can lose a good
327     deal of data if the system goes down unexpectedly.
328 swift 1.1 </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 swift 1.4 We will also have to mount the proc filesystem (a virtual interface with the
444     kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
445 swift 1.1 </p>
446    
447     <p>
448 swift 1.4 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
449 swift 1.1 Installation Files</uri>.
450     </p>
451    
452     </body>
453     </section>
454     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20