/[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.32 - (show annotations) (download) (as text)
Sat Oct 6 19:54:14 2012 UTC (22 months, 3 weeks ago) by swift
Branch: MAIN
Changes since 1.31: +5 -4 lines
File MIME type: application/xml
Part of bug #437338 - Remove acronym YMMV and use a better known sentence (in this case, "your results may vary")

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

  ViewVC Help
Powered by ViewVC 1.1.20