/[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.34 - (show annotations) (download) (as text)
Sat Feb 23 18:38:22 2013 UTC (18 months ago) by swift
Branch: MAIN
CVS Tags: HEAD
Changes since 1.33: +5 -5 lines
File MIME type: application/xml
Fix bug #451596 - Mark ext4 as recommended fs

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

  ViewVC Help
Powered by ViewVC 1.1.20