/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.31 - (show annotations) (download) (as text)
Mon Aug 22 17:18:23 2011 UTC (2 years, 7 months ago) by swift
Branch: MAIN
Changes since 1.30: +11 -7 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-alpha-disk.xml,v 1.30 2009/02/15 06:48:11 rane Exp $ -->
8
9 <sections>
10
11 <version>10</version>
12 <date>2011-08-22</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>Slices</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. On Alpha systems,
29 these are called <e>slices</e>.
30 </p>
31
32 </body>
33 </subsection>
34 </section>
35 <section>
36 <title>Designing a Partitioning Scheme</title>
37 <subsection>
38 <title>Default Partitioning Scheme</title>
39 <body>
40
41 <p>
42 As an example we use the following slice layout:
43 </p>
44
45 <table>
46 <tr>
47 <th>Slice</th>
48 <th>Description</th>
49 </tr>
50 <tr>
51 <ti><path>/dev/sda1</path></ti>
52 <ti>Swap slice</ti>
53 </tr>
54 <tr>
55 <ti><path>/dev/sda2</path></ti>
56 <ti>Root slice</ti>
57 </tr>
58 <tr>
59 <ti><path>/dev/sda3</path></ti>
60 <ti>Full disk (required)</ti>
61 </tr>
62 </table>
63
64
65 <p>
66 If you are interested in knowing how big a partition should be, or even how
67 many partitions (or volumes) you need, read on. Otherwise continue now with
68 <uri link="#fdisk_SRM">Using fdisk to Partition your Disk (SRM only)</uri>
69 or <uri link="#fdisk_ARC">Using fdisk to Partition your Disk (ARC/AlphaBIOS
70 only)</uri>.
71 </p>
72
73 </body>
74 </subsection>
75 <subsection>
76 <title>How Many and How Big?</title>
77 <body>
78
79 <p>
80 The number of partitions is highly dependent on your environment. For instance,
81 if you have lots of users, you will most likely want to have your
82 <path>/home</path> separate as it increases security and makes backups easier.
83 If you are installing Gentoo to perform as a mailserver, your
84 <path>/var</path> should be separate as all mails are stored inside
85 <path>/var</path>. A good choice of filesystem will then maximise your
86 performance. Gameservers will have a separate <path>/opt</path> as most gaming
87 servers are installed there. The reason is similar for <path>/home</path>:
88 security and backups. You will definitely want to keep <path>/usr</path> big:
89 not only will it contain the majority of applications, the Portage tree alone
90 takes around 500 Mbyte excluding the various sources that are stored in it.
91 </p>
92
93 <p>
94 As you can see, it very much depends on what you want to achieve. Separate
95 partitions or volumes have the following advantages:
96 </p>
97
98 <ul>
99 <li>
100 You can choose the best performing filesystem for each partition or volume
101 </li>
102 <li>
103 Your entire system cannot run out of free space if one defunct tool is
104 continuously writing files to a partition or volume
105 </li>
106 <li>
107 If necessary, file system checks are reduced in time, as multiple checks can
108 be done in parallel (although this advantage is more with multiple disks than
109 it is with multiple partitions)
110 </li>
111 <li>
112 Security can be enhanced by mounting some partitions or volumes read-only,
113 nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
114 </li>
115 </ul>
116
117 <p>
118 However, multiple partitions have one big disadvantage: if not configured
119 properly, you might result in having a system with lots
120 of free space on one partition and none on another.
121 </p>
122
123 </body>
124 </subsection>
125 </section>
126 <section id="fdisk_SRM">
127 <title>Using fdisk to Partition your Disk (SRM only)</title>
128 <subsection>
129 <body>
130
131 <p>
132 The following parts explain how to create the example slice layout described
133 previously, namely:
134 </p>
135
136 <table>
137 <tr>
138 <th>Slice</th>
139 <th>Description</th>
140 </tr>
141 <tr>
142 <ti><path>/dev/sda1</path></ti>
143 <ti>Swap slice</ti>
144 </tr>
145 <tr>
146 <ti><path>/dev/sda2</path></ti>
147 <ti>Root slice</ti>
148 </tr>
149 <tr>
150 <ti><path>/dev/sda3</path></ti>
151 <ti>Full disk (required)</ti>
152 </tr>
153 </table>
154
155 <p>
156 Change your slice layout according to your own preference.
157 </p>
158
159
160 </body>
161 </subsection>
162 <subsection>
163 <title>Identifying Available Disks</title>
164 <body>
165
166 <p>
167 To figure out what disks you have running, use the following commands:
168 </p>
169
170 <pre caption="Identifying available disks">
171 # <i>dmesg | grep 'drive$'</i> <comment>(For IDE disks)</comment>
172 # <i>dmesg | grep 'scsi'</i> <comment>(For SCSI disks)</comment>
173 </pre>
174
175 <p>
176 From this output you should be able to see what disks were detected and their
177 respective <path>/dev</path> entry. In the following parts we assume that the
178 disk is a SCSI disk on <path>/dev/sda</path>.
179 </p>
180
181 <p>
182 Now fire up <c>fdisk</c>:
183 </p>
184
185 <pre caption="Starting fdisk">
186 # <i>fdisk /dev/sda</i>
187 </pre>
188
189 </body>
190 </subsection>
191 <subsection>
192 <title>Deleting All Slices</title>
193 <body>
194
195 <p>
196 If your hard drive is completely blank, then you'll have to first create
197 a BSD disklabel.
198 </p>
199
200 <pre caption="Creating a BSD disklabel">
201 Command (m for help): <i>b</i>
202 /dev/sda contains no disklabel.
203 Do you want to create a disklabel? (y/n) <i>y</i>
204 <comment>A bunch of drive-specific info will show here</comment>
205 3 partitions:
206 # start end size fstype [fsize bsize cpg]
207 c: 1 5290* 5289* unused 0 0
208 </pre>
209
210 <p>
211 We start with deleting all slices <e>except</e> the 'c'-slice (a requirement
212 for using BSD disklabels). The following shows how to delete a slice (in
213 the example we use 'a'). Repeat the process to delete all other slices
214 (again, except the 'c'-slice).
215 </p>
216
217 <p>
218 Use <c>p</c> to view all existing slices. <c>d</c> is used to delete a slice.
219 </p>
220
221 <pre caption="Deleting a slice">
222 BSD disklabel command (m for help): <i>p</i>
223
224 8 partitions:
225 # start end size fstype [fsize bsize cpg]
226 a: 1 235* 234* 4.2BSD 1024 8192 16
227 b: 235* 469* 234* swap
228 c: 1 5290* 5289* unused 0 0
229 d: 469* 2076* 1607* unused 0 0
230 e: 2076* 3683* 1607* unused 0 0
231 f: 3683* 5290* 1607* unused 0 0
232 g: 469* 1749* 1280 4.2BSD 1024 8192 16
233 h: 1749* 5290* 3541* unused 0 0
234
235 BSD disklabel command (m for help): <i>d</i>
236 Partition (a-h): <i>a</i>
237 </pre>
238
239 <p>
240 After repeating this process for all slices, a listing should show you something
241 similar to this:
242 </p>
243
244 <pre caption="Viewing an empty scheme">
245 BSD disklabel command (m for help): <i>p</i>
246
247 3 partitions:
248 # start end size fstype [fsize bsize cpg]
249 c: 1 5290* 5289* unused 0 0
250 </pre>
251
252 </body>
253 </subsection>
254 <subsection>
255 <title>Creating the Swap Slice</title>
256 <body>
257
258 <p>
259 On Alpha based systems you don't need a separate boot slice. However, the
260 first cylinder cannot be used as the <c>aboot</c> image will be placed there.
261 </p>
262
263 <p>
264 We will create a swap slice starting at the third cylinder, with a total
265 size of 1 GB. Use <c>n</c> to create a new slice. After creating the slice,
266 we will change its type to <c>1</c> (one), meaning <e>swap</e>.
267 </p>
268
269 <pre caption="Creating the swap slice">
270 BSD disklabel command (m for help): <i>n</i>
271 Partition (a-p): <i>a</i>
272 First cylinder (1-5290, default 1): <i>3</i>
273 Last cylinder or +size or +sizeM or +sizeK (3-5290, default 5290): <i>+1024M</i>
274
275 BSD disklabel command (m for help): <i>t</i>
276 Partition (a-c): <i>a</i>
277 Hex code (type L to list codes): <i>1</i>
278 </pre>
279
280 <p>
281 After these steps you should see a layout similar to the following:
282 </p>
283
284 <pre caption="Slice layout after creating the swap slice">
285 BSD disklabel command (m for help): <i>p</i>
286
287 3 partitions:
288 # start end size fstype [fsize bsize cpg]
289 a: 3 1003 1001 swap
290 c: 1 5290* 5289* unused 0 0
291 </pre>
292
293 </body>
294 </subsection>
295 <subsection>
296 <title>Create the Root Slice</title>
297 <body>
298
299 <p>
300 We will now create the root slice, starting from the first cylinder <e>after</e>
301 the swap slice. Use the <c>p</c> command to view where the swap slice ends. In
302 our example, this is at 1003, making the root slice start at 1004.
303 </p>
304
305 <p>
306 Another problem is that there is currently a bug in <c>fdisk</c> making it think
307 the number of available cylinders is one above the real number of cylinders. In
308 other words, when you are asked for the last cylinder, decrease the cylinder
309 number (in this example: 5290) with one.
310 </p>
311
312 <p>
313 When the slice is created, we change the type to <c>8</c>, for <e>ext2</e>.
314 </p>
315
316 <pre caption="Creating the root slice">
317 D disklabel command (m for help): <i>n</i>
318 Partition (a-p): <i>b</i>
319 First cylinder (1-5290, default 1): <i>1004</i>
320 Last cylinder or +size or +sizeM or +sizeK (1004-5290, default 5290): <i>5289</i>
321
322 BSD disklabel command (m for help): <i>t</i>
323 Partition (a-c): <i>b</i>
324 Hex code (type L to list codes): <i>8</i>
325 </pre>
326
327 <p>
328 Your slice layout should now be similar to this:
329 </p>
330
331 <pre caption="Viewing the slice layout">
332 BSD disklabel command (m for help): <i>p</i>
333
334 3 partitions:
335 # start end size fstype [fsize bsize cpg]
336 a: 3 1003 1001 swap
337 b: 1004 5289 4286 ext2
338 c: 1 5290* 5289* unused 0 0
339 </pre>
340
341 </body>
342 </subsection>
343 <subsection>
344 <title>Save the Slice Layout and Exit</title>
345 <body>
346
347 <p>
348 Save <c>fdisk</c> by typing <c>w</c>. This will also save your slice layout.
349 </p>
350
351 <pre caption="Save and exit fdisk">
352 Command (m for help): <i>w</i>
353 </pre>
354
355 <p>
356 Now that your slices are created, you can continue with <uri
357 link="#filesystems">Creating Filesystems</uri>.
358 </p>
359
360 </body>
361 </subsection>
362 </section>
363 <section id="fdisk_ARC">
364 <title>Using fdisk to Partition your Disk (ARC/AlphaBIOS only)</title>
365 <subsection>
366 <body>
367
368 <p>
369 The following parts explain how to partition the disk with a layout
370 similar to the one described previously, namely:
371 </p>
372
373 <table>
374 <tr>
375 <th>Partition</th>
376 <th>Description</th>
377 </tr>
378 <tr>
379 <ti><path>/dev/sda1</path></ti>
380 <ti>Boot partition</ti>
381 </tr>
382 <tr>
383 <ti><path>/dev/sda2</path></ti>
384 <ti>Swap partition</ti>
385 </tr>
386 <tr>
387 <ti><path>/dev/sda3</path></ti>
388 <ti>Root partition</ti>
389 </tr>
390 </table>
391
392 <p>
393 Change your partition layout according to your own preference.
394 </p>
395
396 </body>
397 </subsection>
398 <subsection>
399 <title>Identifying Available Disks</title>
400 <body>
401
402 <p>
403 To figure out what disks you have running, use the following commands:
404 </p>
405
406 <pre caption="Identifying available disks">
407 # <i>dmesg | grep 'drive$'</i> <comment>(For IDE disks)</comment>
408 # <i>dmesg | grep 'scsi'</i> <comment>(For SCSI disks)</comment>
409 </pre>
410
411 <p>
412 From this output you should be able to see what disks were detected and their
413 respective <path>/dev</path> entry. In the following parts we assume that the
414 disk is a SCSI disk on <path>/dev/sda</path>.
415 </p>
416
417 <p>
418 Now fire up <c>fdisk</c>:
419 </p>
420
421 <pre caption="Starting fdisk">
422 # <i>fdisk /dev/sda</i>
423 </pre>
424
425 </body>
426 </subsection>
427 <subsection>
428 <title>Deleting All Partitions</title>
429 <body>
430
431 <p>
432 If your hard drive is completely blank, then you'll have to first create
433 a DOS disklabel.
434 </p>
435
436 <pre caption="Creating a DOS disklabel">
437 Command (m for help): <i>o</i>
438 Building a new DOS disklabel.
439 </pre>
440
441 <p>
442 We start with deleting all partitions. The following shows how to delete
443 a partition (in the example we use '1'). Repeat the process to delete all
444 other partitions.
445 </p>
446
447 <p>
448 Use <c>p</c> to view all existing partitions. <c>d</c> is used to delete a
449 partition.
450 </p>
451
452 <pre caption="Deleting a partition">
453 command (m for help): <i>p</i>
454
455 Disk /dev/sda: 9150 MB, 9150996480 bytes
456 64 heads, 32 sectors/track, 8727 cylinders
457 Units = cylinders of 2048 * 512 = 1048576 bytes
458
459 Device Boot Start End Blocks Id System
460 /dev/sda1 1 478 489456 83 Linux
461 /dev/sda2 479 8727 8446976 5 Extended
462 /dev/sda5 479 1433 977904 83 Linux Swap
463 /dev/sda6 1434 8727 7469040 83 Linux
464
465 command (m for help): <i>d</i>
466 Partition number (1-6): <i>1</i>
467 </pre>
468
469
470 </body>
471 </subsection>
472 <subsection>
473 <title>Creating the Boot Partition</title>
474 <body>
475
476 <p>
477 On Alpha systems which use MILO to boot, we have to create a small vfat
478 boot partition.
479 </p>
480
481 <pre caption="Creating the boot partition">
482 Command (m for help): <i>n</i>
483 Command action
484 e extended
485 p primary partition (1-4)
486 <i>p</i>
487 Partition number (1-4): <i>1</i>
488 First cylinder (1-8727, default 1): <i>1</i>
489 Last cylinder or +size or +sizeM or +sizeK (1-8727, default 8727): <i>+16M</i>
490
491 Command (m for help): <i>t</i>
492 Selected partition 1
493 Hex code (type L to list codes): <i>6</i>
494 Changed system type of partition 1 to 6 (FAT16)
495 </pre>
496
497 </body>
498 </subsection>
499 <subsection>
500 <title>Creating the Swap Partition</title>
501 <body>
502
503 <p>
504 We will create a swap partition with a total size of 1 GB. Use <c>n</c> to
505 create a new partition.
506 </p>
507
508 <pre caption="Creating the swap partition">
509 Command (m for help): <i>n</i>
510 Command action
511 e extended
512 p primary partition (1-4)
513 <i>p</i>
514 Partition number (1-4): <i>2</i>
515 First cylinder (17-8727, default 17): <i>17</i>
516 Last cylinder or +size or +sizeM or +sizeK (17-8727, default 8727): <i>+1000M</i>
517
518 Command (m for help): <i>t</i>
519 Partition number (1-4): <i>2</i>
520 Hex code (type L to list codes): <i>82</i>
521 Changed system type of partition 2 to 82 (Linux swap)
522 </pre>
523
524 <p>
525 After these steps you should see a layout similar to the following:
526 </p>
527
528 <pre caption="Partition listing after creating a swap partition">
529 Command (m for help): <i>p</i>
530
531 Disk /dev/sda: 9150 MB, 9150996480 bytes
532 64 heads, 32 sectors/track, 8727 cylinders
533 Units = cylinders of 2048 * 512 = 1048576 bytes
534
535 Device Boot Start End Blocks Id System
536 /dev/sda1 1 16 16368 6 FAT16
537 /dev/sda2 17 971 977920 82 Linux swap
538 </pre>
539
540 </body>
541 </subsection>
542 <subsection>
543 <title>Creating the Root Partition</title>
544 <body>
545
546 <p>
547 We will now create the root partition. Again, just use the <c>n</c> command.
548 </p>
549
550 <pre caption="Creating the root partition">
551 Command (m for help): <i>n</i>
552 Command action
553 e extended
554 p primary partition (1-4)
555 <i>p</i>
556 Partition number (1-4): <i>3</i>
557 First cylinder (972-8727, default 972): <i>972</i>
558 Last cylinder or +size or +sizeM or +sizeK (972-8727, default 8727): <i>8727</i>
559 </pre>
560
561 <p>
562 After these steps you should see a layout similar to the following:
563 </p>
564
565 <pre caption="Partition listing after creating the root partition">
566 Command (m for help): <i>p</i>
567
568 Disk /dev/sda: 9150 MB, 9150996480 bytes
569 64 heads, 32 sectors/track, 8727 cylinders
570 Units = cylinders of 2048 * 512 = 1048576 bytes
571
572 Device Boot Start End Blocks Id System
573 /dev/sda1 1 16 16368 6 FAT16
574 /dev/sda2 17 971 977920 82 Linux swap
575 /dev/sda3 972 8727 7942144 83 Linux
576 </pre>
577
578 </body>
579 </subsection>
580 <subsection>
581 <title>Save the Partition Layout and Exit</title>
582 <body>
583
584 <p>
585 Save <c>fdisk</c> by typing <c>w</c>. This will also save your partition layout.
586 </p>
587
588 <pre caption="Save and exit fdisk">
589 Command (m for help): <i>w</i>
590 </pre>
591
592 <p>
593 Now that your partitions are created, you can continue with <uri
594 link="#filesystems">Creating Filesystems</uri>.
595 </p>
596
597 </body>
598 </subsection>
599 </section>
600 <section id="filesystems">
601 <title>Creating Filesystems</title>
602 <subsection>
603 <title>Introduction</title>
604 <body>
605
606 <p>
607 Now that your partitions are created, it is time to place a filesystem on them.
608 If you don't care about what filesystem to choose and are happy with what we use
609 as default in this handbook, continue with <uri
610 link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
611 Otherwise read on to learn about the available filesystems...
612 </p>
613
614 </body>
615 </subsection>
616
617 <subsection>
618 <include href="hb-install-filesystems.xml"/>
619 </subsection>
620
621 <subsection id="filesystems-apply">
622 <title>Applying a Filesystem to a Partition</title>
623 <body>
624
625 <p>
626 To create a filesystem on a partition or volume, there are tools available for
627 each possible filesystem:
628 </p>
629
630 <table>
631 <tr>
632 <th>Filesystem</th>
633 <th>Creation Command</th>
634 </tr>
635 <tr>
636 <ti>ext2</ti>
637 <ti><c>mkfs.ext2</c></ti>
638 </tr>
639 <tr>
640 <ti>ext3</ti>
641 <ti><c>mkfs.ext3</c></ti>
642 </tr>
643 <tr>
644 <ti>ext4</ti>
645 <ti><c>mkfs.ext4</c></ti>
646 </tr>
647 <tr>
648 <ti>reiserfs</ti>
649 <ti><c>mkfs.reiserfs</c></ti>
650 </tr>
651 <tr>
652 <ti>xfs</ti>
653 <ti><c>mkfs.xfs</c></ti>
654 </tr>
655 <tr>
656 <ti>jfs</ti>
657 <ti><c>mkfs.jfs</c></ti>
658 </tr>
659 </table>
660
661 <p>
662 For instance, to have the root partition (<path>/dev/sda2</path> in our example)
663 in ext3, you would use:
664 </p>
665
666 <pre caption="Applying a filesystem on a partition">
667 # <i>mkfs.ext3 /dev/sda2</i>
668 </pre>
669
670 <p>
671 Now create the filesystems on your newly created partitions (or logical
672 volumes).
673 </p>
674
675 </body>
676 </subsection>
677 <subsection>
678 <title>Activating the Swap Partition</title>
679 <body>
680
681 <p>
682 <c>mkswap</c> is the command that is used to initialize swap partitions:
683 </p>
684
685 <pre caption="Creating a Swap signature">
686 # <i>mkswap /dev/sda1</i>
687 </pre>
688
689 <p>
690 To activate the swap partition, use <c>swapon</c>:
691 </p>
692
693 <pre caption="Activating the swap partition">
694 # <i>swapon /dev/sda1</i>
695 </pre>
696
697 <p>
698 Create and activate the swap with the commands mentioned above.
699 </p>
700
701 </body>
702 </subsection>
703 </section>
704 <section>
705 <title>Mounting</title>
706 <body>
707
708 <p>
709 Now that your partitions are initialized and are housing a filesystem, it is
710 time to mount those partitions. Use the <c>mount</c> command. Don't forget to
711 create the necessary mount directories for every partition you created. As an
712 example we mount the root partition:
713 </p>
714
715 <pre caption="Mounting partitions">
716 # <i>mount /dev/sda2 /mnt/gentoo</i>
717 </pre>
718
719 <note>
720 If you want your <path>/tmp</path> to reside on a separate partition, be sure to
721 change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This
722 also holds for <path>/var/tmp</path>.
723 </note>
724
725 <p>
726 We will also have to mount the proc filesystem (a virtual interface with the
727 kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
728 </p>
729
730 <p>
731 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
732 Installation Files</uri>.
733 </p>
734
735 </body>
736 </section>
737 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20