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

  ViewVC Help
Powered by ViewVC 1.1.20