/[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.29 - (show annotations) (download) (as text)
Mon Aug 22 17:18:23 2011 UTC (3 years ago) by swift
Branch: MAIN
Changes since 1.28: +9 -9 lines
File MIME type: application/xml
Fix bug #334167 - Mention ext4 in the handbook. Done for alpha, mips, amd64 and x86. Other arches: please verify and comment on the bug. Thanks to Maciej Grela for reporting.

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

  ViewVC Help
Powered by ViewVC 1.1.20