/[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.7 - (show annotations) (download) (as text)
Tue Nov 9 13:01:52 2004 UTC (9 years, 9 months ago) by swift
Branch: MAIN
Changes since 1.6: +5 -1 lines
File MIME type: application/xml
Adding version/date information in pages

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

  ViewVC Help
Powered by ViewVC 1.1.20