/[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.31 - (show annotations) (download) (as text)
Mon Oct 17 19:51:45 2011 UTC (2 years, 10 months ago) by swift
Branch: MAIN
Changes since 1.30: +13 -7 lines
File MIME type: application/xml
Enhancing information on downsides wrt multiple partitions.

This hopefully also clears up some of the confusion that is surrounding
separate /usr partitions. Yes, it now mentions that an initramfs might be
needed in that case.

And no, we do not "recommend" a separate /usr partition, nor do we
"not recommend" it.

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

  ViewVC Help
Powered by ViewVC 1.1.20