/[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.27 - (show annotations) (download) (as text)
Mon Jan 26 08:04:26 2009 UTC (5 years, 6 months ago) by nightmorph
Branch: MAIN
Changes since 1.26: +2 -2 lines
File MIME type: application/xml
Engrish fixes, bug 253374

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/2.5 -->
6
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-mips-disk.xml,v 1.26 2008/05/02 08:04:23 nightmorph Exp $ -->
8
9 <sections>
10
11 <version>3.1</version>
12 <date>2008-05-02</date>
13
14 <section>
15 <title>Introduction to Block Devices</title>
16
17 <subsection>
18 <include href="hb-install-blockdevices.xml"/>
19 </subsection>
20
21 <subsection>
22 <title>Partitions</title>
23 <body>
24
25 <p>
26 Although it is theoretically possible to use a full disk to house your Linux
27 system, this is almost never done in practice. Instead, full disk block devices
28 are split up in smaller, more manageable block devices. These are called
29 <e>partitions</e>.
30 </p>
31
32 </body>
33 </subsection>
34 </section>
35 <section>
36 <title>Designing a Partitioning Scheme</title>
37 <subsection>
38 <title>How Many and How Big?</title>
39 <body>
40
41 <p>
42 The number of partitions is highly dependent on your environment. For instance,
43 if you have lots of users, you will most likely want to have your
44 <path>/home</path> separate as it increases security and makes backups easier.
45 If you are installing Gentoo to perform as a mailserver, your <path>/var</path>
46 should be separate as all mails are stored inside <path>/var</path>. A good
47 choice of filesystem will then maximise your performance. Gameservers will have
48 a separate <path>/opt</path> as most gaming servers are installed there. The
49 reason is similar for <path>/home</path>: security and backups. You will
50 definitely want to keep <path>/usr</path> big: not only will it contain the
51 majority of applications, the Portage tree alone takes around 500 Mbyte
52 excluding the various sources that are stored in it.
53 </p>
54
55 <p>
56 As you can see, it very much depends on what you want to achieve. Separate
57 partitions or volumes have the following advantages:
58 </p>
59
60 <ul>
61 <li>
62 You can choose the best performing filesystem for each partition or volume
63 </li>
64 <li>
65 Your entire system cannot run out of free space if one defunct tool is
66 continuously writing files to a partition or volume
67 </li>
68 <li>
69 If necessary, file system checks are reduced in time, as multiple checks can
70 be done in parallel (although this advantage is more with multiple disks than
71 it is with multiple partitions)
72 </li>
73 <li>
74 Security can be enhanced by mounting some partitions or volumes read-only,
75 nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
76 </li>
77 </ul>
78
79 <p>
80 However, multiple partitions have one big disadvantage: if not configured
81 properly, you might result in having a system with lots of free space on one
82 partition and none on another. There is also a 15-partition limit for SCSI and
83 SATA.
84 </p>
85
86 </body>
87 </subsection>
88 </section>
89 <section>
90 <title>Using fdisk on MIPS to Partition your Disk</title>
91 <subsection>
92 <title>SGI Machines: Creating an SGI Disk Label</title>
93 <body>
94
95 <p>
96 All disks in an SGI System require an <e>SGI Disk Label</e>, which serves a
97 similar function as Sun &amp; MS-DOS disklabels -- It stores information about
98 the disk partitions. Creating a new SGI Disk Label will create two special
99 partitions on the disk:
100 </p>
101
102 <ul>
103 <li>
104 <e>SGI Volume Header</e> (9th partition): This partition is important. It
105 is where the bootloader will reside, and in some cases, it will also
106 contain the kernel images.
107 </li>
108 <li>
109 <e>SGI Volume</e> (11th partition): This partition is similar in purpose to
110 the Sun Disklabel's third partition of "Whole Disk". This partition spans
111 the entire disk, and should be left untouched. It serves no special purpose
112 other than to assist the PROM in some undocumented fashion (or it is used
113 by IRIX in some way).
114 </li>
115 </ul>
116
117 <warn>
118 The SGI Volume Header <e>must</e> begin at cylinder 0. Failure to do so means
119 you won't be able to boot from the disk.
120 </warn>
121
122 <p>
123 The following is an example excerpt from an <c>fdisk</c> session. Read and
124 tailor it to your needs...
125 </p>
126
127 <pre caption="Creating an SGI Disklabel">
128 # <i>fdisk /dev/sda</i>
129
130 Command (m for help): <i>x</i>
131
132 Expert command (m for help): <i>m</i>
133 Command action
134 b move beginning of data in a partition
135 c change number of cylinders
136 d print the raw data in the partition table
137 e list extended partitions
138 f fix partition order
139 g create an IRIX (SGI) partition table
140 h change number of heads
141 m print this menu
142 p print the partition table
143 q quit without saving changes
144 r return to main menu
145 s change number of sectors/track
146 v verify the partition table
147 w write table to disk and exit
148
149 Expert command (m for help): <i>g</i>
150 Building a new SGI disklabel. Changes will remain in memory only,
151 until you decide to write them. After that, of course, the previous
152 content will be irrecoverably lost.
153
154 Expert command (m for help): <i>r</i>
155
156 Command (m for help): <i>p</i>
157
158 Disk /dev/sda (SGI disk label): 64 heads, 32 sectors, 17482 cylinders
159 Units = cylinders of 2048 * 512 bytes
160
161 ----- partitions -----
162 Pt# Device Info Start End Sectors Id System
163 9: /dev/sda1 0 4 10240 0 SGI volhdr
164 11: /dev/sda2 0 17481 35803136 6 SGI volume
165 ----- Bootinfo -----
166 Bootfile: /unix
167 ----- Directory Entries -----
168
169 Command (m for help):
170 </pre>
171
172 <note>
173 If your disk already has an existing SGI Disklabel, then fdisk will not allow
174 the creation of a new label. There are two ways around this. One is to create a
175 Sun or MS-DOS disklabel, write the changes to disk, and restart fdisk. The
176 second is to overwrite the partition table with null data via the following
177 command: <c>dd if=/dev/zero of=/dev/sda bs=512 count=1</c>.
178 </note>
179 </body>
180 </subsection>
181
182 <subsection>
183 <title>Getting the SGI Volume Header to just the right size</title>
184 <body>
185
186 <impo>
187 This step is often needed, due to a bug in <c>fdisk</c>. For some reason, the
188 volume header isn't created correctly, the end result being it starts and ends
189 on cylinder 0. This prevents multiple partitions from being created. To get
190 around this issue... read on.
191 </impo>
192
193 <p>
194 Now that an SGI Disklabel is created, partitions may now be defined. In the
195 above example, there are already two partitions defined for you. These are the
196 special partitions mentioned above and should not normally be altered. However,
197 for installing Gentoo, we'll need to load a bootloader, and possibly multiple
198 kernel images (depending on system type) directly into the volume header. The
199 volume header itself can hold up to <e>eight</e> images of any size, with each
200 image allowed eight-character names.
201 </p>
202
203 <p>
204 The process of making the volume header larger isn't exactly straight-forward;
205 there's a bit of a trick to it. One cannot simply delete and re-add the volume
206 header due to odd fdisk behavior. In the example provided below, we'll create a
207 50MB Volume header in conjunction with a 50MB /boot partition. The actual
208 layout of your disk may vary, but this is for illustrative purposes only.
209 </p>
210
211 <pre caption="Resizing the SGI Volume Header correctly">
212 Command (m for help): <i>n</i>
213 Partition number (1-16): <i>1</i>
214 First cylinder (5-8682, default 5): <i>51</i>
215 Last cylinder (51-8682, default 8682): <i>101</i>
216
217 <comment>(Notice how fdisk only allows Partition #1 to be re-created starting at a )
218 (minimum of cylinder 5? Had you attempted to delete &amp; re-create the SGI )
219 (Volume Header this way, this is the same issue you would have encountered. )
220 (In our example, we want /boot to be 50MB, so we start it at cylinder 51 (the )
221 (Volume Header needs to start at cylinder 0, remember?), and set its ending )
222 (cylinder to 101, which will roughly be 50MB (+/- 1-5MB). )</comment>
223
224 Command (m for help): <i>d</i>
225 Partition number (1-16): <i>9</i>
226
227 <comment>(Delete Partition #9 (SGI Volume Header))</comment>
228
229 Command (m for help): <i>n</i>
230 Partition number (1-16): <i>9</i>
231 First cylinder (0-50, default 0): <i>0</i>
232 Last cylinder (0-50, default 50): <i>50</i>
233
234 <comment>(Re-Create Partition #9, ending just before Partition #1)</comment>
235 </pre>
236
237 <p>
238 If you're unsure how to use <c>fdisk</c> have a look down further at the
239 instructions for partitioning on Cobalts. The concepts are exactly the same --
240 just remember to leave the volume header and whole disk partitions alone.
241 </p>
242
243 <p>
244 Once this is done, you are safe to create the rest of your partitions as you
245 see fit. After all your partitions are laid out, make sure you set the
246 partition ID of your swap partition to <c>82</c>, which is Linux Swap. By
247 default, it will be <c>83</c>, Linux Native.
248 </p>
249
250 <p>
251 Now that your partitions are created, you can continue with <uri
252 link="#filesystems">Creating Filesystems</uri>.
253 </p>
254
255 </body>
256 </subsection>
257
258 <subsection>
259 <title>Cobalt Machines: Partitioning your drive</title>
260 <body>
261
262 <p>
263 On Cobalt machines, the BOOTROM expects to see a MS-DOS MBR, so partitioning
264 the drive is relatively straightforward -- in fact, it's done the same way as
265 you'd do for an Intel x86 machine. <e>However</e> there are some things you
266 need to bear in mind.
267 </p>
268
269 <ul>
270 <li>
271 Cobalt firmware will expect <path>/dev/sda1</path> to be a Linux partition
272 formatted <e>EXT2 Revision 0</e>. <e>EXT2 Revision 1 partitions will NOT
273 WORK!</e> (The Cobalt BOOTROM only understands EXT2r0)
274 </li>
275 <li>
276 The above said partition must contain a gzipped ELF image,
277 <path>vmlinux.gz</path> in the root of that partition, which it loads as
278 the kernel
279 </li>
280 </ul>
281
282 <p>
283 For that reason, I recommend creating a ~20MB <path>/boot</path> partition
284 formatted EXT2r0 upon which you can install CoLo &amp; your kernels. This
285 allows you to run a modern filesystem (EXT3 or ReiserFS) for your root
286 filesystem.
287 </p>
288
289 <p>
290 I will assume you have created <path>/dev/sda1</path> to mount later as a
291 <path>/boot</path> partition. If you wish to make this <path>/</path>, you'll
292 need to keep the PROM's expectations in mind.
293 </p>
294
295 <p>
296 So, continuing on... To create the partitions you type <c>fdisk /dev/sda</c> at
297 the prompt. The main commands you need to know are these:
298 </p>
299
300 <ul>
301 <li>
302 <c>o</c>: Wipe out old partition table, starting with an empty MS-DOS
303 partition table
304 </li>
305 <li>
306 <c>n</c>: New Partition
307 </li>
308 <li>
309 <c>t</c>: Change Partition Type
310 <ul>
311 <li>Use type <c>82</c> for Linux Swap, <c>83</c> for Linux FS</li>
312 </ul>
313 </li>
314 <li>
315 <c>d</c>: Delete a partition
316 </li>
317 <li>
318 <c>p</c>: Display (print) Partition Table
319 </li>
320 <li>
321 <c>q</c>: Quit -- leaving old partition table as is.
322 </li>
323 <li>
324 <c>w</c>: Quit -- writing partition table in the process.
325 </li>
326 </ul>
327
328 <pre caption="Partitioning the disk">
329 # <i>fdisk /dev/sda</i>
330
331 The number of cylinders for this disk is set to 19870.
332 There is nothing wrong with that, but this is larger than 1024,
333 and could in certain setups cause problems with:
334 1) software that runs at boot time (e.g., old versions of LILO)
335 2) booting and partitioning software from other OSs
336 (e.g., DOS FDISK, OS/2 FDISK)
337
338 <comment>(Start by clearing out any existing partitions)</comment>
339 Command (m for help): <i>o</i>
340 Building a new DOS disklabel. Changes will remain in memory only,
341 until you decide to write them. After that, of course, the previous
342 content won't be recoverable.
343
344
345 The number of cylinders for this disk is set to 19870.
346 There is nothing wrong with that, but this is larger than 1024,
347 and could in certain setups cause problems with:
348 1) software that runs at boot time (e.g., old versions of LILO)
349 2) booting and partitioning software from other OSs
350 (e.g., DOS FDISK, OS/2 FDISK)
351 Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
352
353 <comment>(You can now verify the partition table is empty using the 'p' command)</comment>
354
355 Command (m for help): <i>p</i>
356
357 Disk /dev/sda: 10.2 GB, 10254827520 bytes
358 16 heads, 63 sectors/track, 19870 cylinders
359 Units = cylinders of 1008 * 512 = 516096 bytes
360
361 Device Boot Start End Blocks Id System
362
363 <comment>(Create the /boot partition)</comment>
364
365 Command (m for help): <i>n</i>
366 Command action
367 e extended
368 p primary partition (1-4)
369 <i>p</i>
370 Partition number (1-4): <i>1</i>
371
372 <comment>(Just press ENTER here to accept the default)</comment>
373
374 First cylinder (1-19870, default 1):
375 Last cylinder or +size or +sizeM or +sizeK (1-19870, default 19870): <i>+20M</i>
376
377 <comment>(and now if we type 'p' again, we should see the new partition)</comment>
378 Command (m for help): <i>p</i>
379
380 Disk /dev/sda: 10.2 GB, 10254827520 bytes
381 16 heads, 63 sectors/track, 19870 cylinders
382 Units = cylinders of 1008 * 512 = 516096 bytes
383
384 Device Boot Start End Blocks Id System
385 /dev/sda1 1 40 20128+ 83 Linux
386
387 <comment>(The rest, I prefer to put in an extended partition, so I'll create that)</comment>
388
389 Command (m for help): <i>n</i>
390 Command action
391 e extended
392 p primary partition (1-4)
393 <i>e</i>
394 Partition number (1-4): <i>2</i>
395
396 <comment>(Again, the default is fine, just press ENTER.)</comment>
397
398 First cylinder (41-19870, default 41):
399 Using default value 41
400
401 <comment>(We want to use the whole disk here, so just press ENTER again)</comment>
402 Last cylinder or +size or +sizeM or +sizeK (41-19870, default 19870):
403 Using default value 19870
404
405 <comment>(Now, the / partition -- I use separate partitions for /usr, /var,
406 etc... so / can be small. Adjust as per your preference.)</comment>
407
408 Command (m for help): <i>n</i>
409 Command action
410 l logical (5 or over)
411 p primary partition (1-4)
412 <i>l</i>
413 First cylinder (41-19870, default 41):<i>&lt;Press ENTER&gt;</i>
414 Using default value 41
415 Last cylinder or +size or +sizeM or +sizeK (41-19870, default 19870): <i>+500M</i>
416
417 <comment>(... and similar for any other partitions ...)</comment>
418
419 <comment>(Last but not least, the swap space. I recommend at least 250MB swap,
420 preferrably 1GB)</comment>
421
422 Command (m for help): <i>n</i>
423 Command action
424 l logical (5 or over)
425 p primary partition (1-4)
426 <i>l</i>
427 First cylinder (17294-19870, default 17294): <i>&lt;Press ENTER&gt;</i>
428 Using default value 17294
429 Last cylinder or +size or +sizeM or +sizeK (1011-19870, default 19870): <i>&lt;Press ENTER&gt;</i>
430 Using default value 19870
431
432 <comment>(Now, if we check our partition table, everything should mostly be ship
433 shape except for one thing...)</comment>
434
435 Command (m for help): <i>p</i>
436
437 Disk /dev/sda: 10.2 GB, 10254827520 bytes
438 16 heads, 63 sectors/track, 19870 cylinders
439 Units = cylinders of 1008 * 512 = 516096 bytes
440
441 Device Boot Start End Blocks ID System
442 /dev/sda1 1 21 10552+ 83 Linux
443 /dev/sda2 22 19870 10003896 5 Extended
444 /dev/sda5 22 1037 512032+ 83 Linux
445 /dev/sda6 1038 5101 2048224+ 83 Linux
446 /dev/sda7 5102 9165 2048224+ 83 Linux
447 /dev/sda8 9166 13229 2048224+ 83 Linux
448 /dev/sda9 13230 17293 2048224+ 83 Linux
449 /dev/sda10 17294 19870 1298776+ 83 Linux
450
451 <comment>(Notice how #10, our swap partition is still type 83?)</comment>
452
453 Command (m for help): <i>t</i>
454 Partition number (1-10): <i>10</i>
455 Hex code (type L to list codes): <i>82</i>
456 Changed system type of partition 10 to 82 (Linux swap)
457
458 <comment>(That should fix it... just to verify...)</comment>
459
460 Command (m for help): <i>p</i>
461
462 Disk /dev/sda: 10.2 GB, 10254827520 bytes
463 16 heads, 63 sectors/track, 19870 cylinders
464 Units = cylinders of 1008 * 512 = 516096 bytes
465
466 Device Boot Start End Blocks ID System
467 /dev/sda1 1 21 10552+ 83 Linux
468 /dev/sda2 22 19870 10003896 5 Extended
469 /dev/sda5 22 1037 512032+ 83 Linux
470 /dev/sda6 1038 5101 2048224+ 83 Linux
471 /dev/sda7 5102 9165 2048224+ 83 Linux
472 /dev/sda8 9166 13229 2048224+ 83 Linux
473 /dev/sda9 13230 17293 2048224+ 83 Linux
474 /dev/sda10 17294 19870 1298776+ 82 Linux Swap
475
476 <comment>(Now, we write out the new partition table.)</comment>
477
478 Command (m for help): <i>w</i>
479 The partition table has been altered!
480
481 Calling ioctl() to re-read partition table.
482 Syncing disks.
483
484 #
485 </pre>
486
487 <p>
488 And that's all there is to it. You should now be right to proceed onto the next
489 stage: <uri link="#filesystems">Creating Filesystems</uri>.
490 </p>
491
492 </body>
493 </subsection>
494 </section>
495
496 <section id="filesystems">
497 <title>Creating Filesystems</title>
498 <subsection>
499 <title>Introduction</title>
500 <body>
501
502 <p>
503 Now that your partitions are created, it is time to place a filesystem on them.
504 If you don't care about what filesystem to choose and are happy with what we
505 use as default in this handbook, continue with <uri
506 link="#filesystems-apply">Applying a Filesystem to a Partition</uri>. Otherwise
507 read on to learn about the available filesystems...
508 </p>
509
510 </body>
511 </subsection>
512
513 <subsection>
514 <include href="hb-install-filesystems.xml"/>
515 </subsection>
516
517 <subsection id="filesystems-apply">
518 <title>Applying a Filesystem to a Partition</title>
519 <body>
520
521 <p>
522 To create a filesystem on a partition or volume, there are tools available for
523 each possible filesystem:
524 </p>
525
526 <table>
527 <tr>
528 <th>Filesystem</th>
529 <th>Creation Command</th>
530 </tr>
531 <tr>
532 <ti>ext2</ti>
533 <ti><c>mke2fs</c></ti>
534 </tr>
535 <tr>
536 <ti>ext3</ti>
537 <ti><c>mke2fs -j</c></ti>
538 </tr>
539 <tr>
540 <ti>reiserfs</ti>
541 <ti><c>mkreiserfs</c></ti>
542 </tr>
543 <tr>
544 <ti>xfs</ti>
545 <ti><c>mkfs.xfs</c></ti>
546 </tr>
547 <tr>
548 <ti>jfs</ti>
549 <ti><c>mkfs.jfs</c></ti>
550 </tr>
551 </table>
552
553 <p>
554 For instance, to have the boot partition (<path>/dev/sda1</path> in our
555 example) in ext2 and the root partition (<path>/dev/sda3</path> in our example)
556 in ext3, you would use:
557 </p>
558
559 <pre caption="Applying a filesystem on a partition">
560 # <i>mke2fs /dev/sda1</i>
561 # <i>mke2fs -j /dev/sda3</i>
562 </pre>
563
564 <p>
565 Now create the filesystems on your newly created partitions (or logical
566 volumes).
567 </p>
568
569 <warn>
570 If you're installing on a Cobalt server, remember <path>/dev/sda1</path> MUST
571 be of type <e>EXT2 revision 0</e>; Anything else (e.g. EXT2 revision 1, EXT3,
572 ReiserFS, XFS, JFS and others) <e>WILL NOT WORK!</e> You can format the
573 partition using the command: <c>mke2fs -r 0 /dev/sda1</c>.
574 </warn>
575
576 </body>
577 </subsection>
578 <subsection>
579 <title>Activating the Swap Partition</title>
580 <body>
581
582 <p>
583 <c>mkswap</c> is the command that is used to create and initialize swap
584 partitions:
585 </p>
586
587 <pre caption="Creating a Swap signature">
588 # <i>mkswap /dev/sda2</i>
589 </pre>
590
591 <p>
592 To activate the swap partition, use <c>swapon</c>:
593 </p>
594
595 <pre caption="Activating the swap partition">
596 # <i>swapon /dev/sda2</i>
597 </pre>
598
599 <p>
600 Create and activate the swap with the commands mentioned above.
601 </p>
602
603 </body>
604 </subsection>
605 </section>
606 <section>
607 <title>Mounting</title>
608 <body>
609
610 <p>
611 Now that your partitions are initialized and are housing a filesystem, it is
612 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
613 create the necessary mount directories for every partition you created. As an
614 example we mount the root and boot partition:
615 </p>
616
617 <pre caption="Mounting partitions">
618 # <i>mount /dev/sda3 /mnt/gentoo</i>
619 # <i>mkdir /mnt/gentoo/boot</i>
620 # <i>mount /dev/sda1 /mnt/gentoo/boot</i>
621 </pre>
622
623 <note>
624 If you want your <path>/tmp</path> to reside on a separate partition, be sure
625 to change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>.
626 This also holds for <path>/var/tmp</path>.
627 </note>
628
629 <p>
630 We will also have to mount the proc filesystem (a virtual interface with the
631 kernel) on <path>/proc</path>. But first we will need to place our files on the
632 partitions.
633 </p>
634
635 <p>
636 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo Installation
637 Files</uri>.
638 </p>
639
640 </body>
641 </section>
642 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20