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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.11 Revision 1.31
1<?xml version='1.0' encoding='UTF-8'?> 1<?xml version='1.0' encoding='UTF-8'?>
2<!DOCTYPE sections SYSTEM "/dtd/book.dtd"> 2<!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3 3
4<!-- The content of this document is licensed under the CC-BY-SA license --> 4<!-- The content of this document is licensed under the CC-BY-SA license -->
5<!-- See http://creativecommons.org/licenses/by-sa/1.0 --> 5<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
6 6
7<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml,v 1.11 2004/11/15 12:47:47 swift Exp $ --> 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 8
9<sections> 9<sections>
10 10
11<version>1.9</version> 11<version>10</version>
12<date>August 30, 2004</date> 12<date>2011-08-22</date>
13 13
14<section> 14<section>
15<title>Introduction to Block Devices</title> 15<title>Introduction to Block Devices</title>
16<subsection>
17<title>Block Devices</title>
18<body>
19 16
20<p>
21We'll take a good look at disk-oriented aspects of Gentoo Linux
22and Linux in general, including Linux filesystems, partitions and block devices.
23Then, once you're familiar with the ins and outs of disks and filesystems,
24you'll be guided through the process of setting up partitions and filesystems
25for your Gentoo Linux installation.
26</p>
27
28<p>
29To begin, we'll introduce <e>block devices</e>. The most famous block device is
30probably the one that represents the first SCSI HD in a Linux system, namely
31<path>/dev/sda</path>.
32</p>
33
34<p>
35The block devices above represent an abstract interface to the disk. User
36programs can use these block devices to interact with your disk without worrying
37about whether your drives are IDE, SCSI or something else. The program can
38simply address the storage on the disk as a bunch of contiguous,
39randomly-accessible 512-byte blocks.
40</p>
41
42</body>
43</subsection> 17<subsection>
18<include href="hb-install-blockdevices.xml"/>
19</subsection>
20
44<subsection> 21<subsection>
45<title>Slices</title> 22<title>Slices</title>
46<body> 23<body>
47 24
48<p> 25<p>
86 63
87 64
88<p> 65<p>
89If you are interested in knowing how big a partition should be, or even how 66If you are interested in knowing how big a partition should be, or even how
90many partitions (or volumes) you need, read on. Otherwise continue now with 67many partitions (or volumes) you need, read on. Otherwise continue now with
91<uri link="#fdisk">Using fdisk to Partition your Disk</uri>. 68<uri link="#fdisk_SRM">Using fdisk to Partition your Disk (SRM only)</uri>
69or <uri link="#fdisk_ARC">Using fdisk to Partition your Disk (ARC/AlphaBIOS
70only)</uri>.
92</p> 71</p>
93 72
94</body> 73</body>
95</subsection> 74</subsection>
96<subsection> 75<subsection>
104If you are installing Gentoo to perform as a mailserver, your 83If you are installing Gentoo to perform as a mailserver, your
105<path>/var</path> should be separate as all mails are stored inside 84<path>/var</path> should be separate as all mails are stored inside
106<path>/var</path>. A good choice of filesystem will then maximise your 85<path>/var</path>. A good choice of filesystem will then maximise your
107performance. Gameservers will have a separate <path>/opt</path> as most gaming 86performance. Gameservers will have a separate <path>/opt</path> as most gaming
108servers are installed there. The reason is similar for <path>/home</path>: 87servers are installed there. The reason is similar for <path>/home</path>:
109security and backups. 88security and backups. You will definitely want to keep <path>/usr</path> big:
89not only will it contain the majority of applications, the Portage tree alone
90takes around 500 Mbyte excluding the various sources that are stored in it.
110</p> 91</p>
111 92
112<p> 93<p>
113As you can see, it very much depends on what you want to achieve. Separate 94As you can see, it very much depends on what you want to achieve. Separate
114partitions or volumes have the following advantages: 95partitions or volumes have the following advantages:
140</p> 121</p>
141 122
142</body> 123</body>
143</subsection> 124</subsection>
144</section> 125</section>
145<section id="fdisk"> 126<section id="fdisk_SRM">
146<title>Using fdisk on Alpha to Partition your Disk</title> 127<title>Using fdisk to Partition your Disk (SRM only)</title>
147<subsection> 128<subsection>
148<body> 129<body>
149 130
150<p> 131<p>
151The following parts explain how to create the example slice layout described 132The following parts explain how to create the example slice layout described
214<p> 195<p>
215If your hard drive is completely blank, then you'll have to first create 196If your hard drive is completely blank, then you'll have to first create
216a BSD disklabel. 197a BSD disklabel.
217</p> 198</p>
218 199
219<pre caption="Creating BSD disklabel"> 200<pre caption="Creating a BSD disklabel">
220Command (m for help): <i>b</i> 201Command (m for help): <i>b</i>
221/dev/sda contains no disklabel. 202/dev/sda contains no disklabel.
222Do you want to create a disklabel? (y/n) <i>y</i> 203Do you want to create a disklabel? (y/n) <i>y</i>
223<comment>A bunch of drive-specific info will show here</comment> 204<comment>A bunch of drive-specific info will show here</comment>
2243 partitions: 2053 partitions:
225# start end size fstype [fsize bsize cpg] 206# start end size fstype [fsize bsize cpg]
226 c: 1 5290* 5289* unused 0 0 207 c: 1 5290* 5289* unused 0 0
227</pre> 208</pre>
228 209
229<p> 210<p>
230We start with deleting all slices <e>except</e> the 'c'-slice. The following 211We start with deleting all slices <e>except</e> the 'c'-slice (a requirement
231shows how to delete a slice (in the example we use 'a'). Repeat the process to 212for using BSD disklabels). The following shows how to delete a slice (in
232delete all other slices (again, except the 'c'-slice). 213the example we use 'a'). Repeat the process to delete all other slices
214(again, except the 'c'-slice).
233</p> 215</p>
234 216
235<p> 217<p>
236Use <c>p</c> to view all existing slices. <c>d</c> is used to delete a slice. 218Use <c>p</c> to view all existing slices. <c>d</c> is used to delete a slice.
237</p> 219</p>
272<subsection> 254<subsection>
273<title>Creating the Swap Slice</title> 255<title>Creating the Swap Slice</title>
274<body> 256<body>
275 257
276<p> 258<p>
277On Alpha based systems you don't need a separate boot partition. However, the 259On Alpha based systems you don't need a separate boot slice. However, the
278first cylinder cannot be used as the <c>aboot</c> image will be placed there. 260first cylinder cannot be used as the <c>aboot</c> image will be placed there.
279</p> 261</p>
280 262
281<p> 263<p>
282We will create a swap slice starting at the third cylinder, with a total 264We will create a swap slice starting at the third cylinder, with a total
283size of 1 Gbyte. Use <c>n</c> to create a new slice. After creating the slice, 265size of 1 GB. Use <c>n</c> to create a new slice. After creating the slice,
284we will change its type to <c>1</c> (one), meaning <e>swap</e>. 266we will change its type to <c>1</c> (one), meaning <e>swap</e>.
285</p> 267</p>
286 268
287<pre caption="Creating the swap slice"> 269<pre caption="Creating the swap slice">
288BSD disklabel command (m for help): <i>n</i> 270BSD disklabel command (m for help): <i>n</i>
315<body> 297<body>
316 298
317<p> 299<p>
318We will now create the root slice, starting from the first cylinder <e>after</e> 300We will now create the root slice, starting from the first cylinder <e>after</e>
319the swap slice. Use the <c>p</c> command to view where the swap slice ends. In 301the swap slice. Use the <c>p</c> command to view where the swap slice ends. In
320our example, this is at 1003, making the root partition start at 1004. 302our example, this is at 1003, making the root slice start at 1004.
321</p> 303</p>
322 304
323<p> 305<p>
324Another problem is that there is currently a bug in <c>fdisk</c> making it think 306Another problem is that there is currently a bug in <c>fdisk</c> making it think
325the number of available cylinders is one above the real number of cylinders. In 307the number of available cylinders is one above the real number of cylinders. In
326other words, when you are asked for the last cylinder, decrease the cylinder 308other words, when you are asked for the last cylinder, decrease the cylinder
327number (in this example: 5290) with one. 309number (in this example: 5290) with one.
328</p> 310</p>
329 311
330<p> 312<p>
331When the partition is created, we change the type to <c>8</c>, for <e>ext2</e>. 313When the slice is created, we change the type to <c>8</c>, for <e>ext2</e>.
332</p> 314</p>
333 315
334<pre caption="Creating the root slice"> 316<pre caption="Creating the root slice">
335D disklabel command (m for help): <i>n</i> 317D disklabel command (m for help): <i>n</i>
336Partition (a-p): <i>b</i> 318Partition (a-p): <i>b</i>
369<pre caption="Save and exit fdisk"> 351<pre caption="Save and exit fdisk">
370Command (m for help): <i>w</i> 352Command (m for help): <i>w</i>
371</pre> 353</pre>
372 354
373<p> 355<p>
374Now that your slices are created, you can now continue with <uri 356Now that your slices are created, you can continue with <uri
357link="#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>
369The following parts explain how to partition the disk with a layout
370similar 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>
393Change 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>
403To 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>
412From this output you should be able to see what disks were detected and their
413respective <path>/dev</path> entry. In the following parts we assume that the
414disk is a SCSI disk on <path>/dev/sda</path>.
415</p>
416
417<p>
418Now 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>
432If your hard drive is completely blank, then you'll have to first create
433a DOS disklabel.
434</p>
435
436<pre caption="Creating a DOS disklabel">
437Command (m for help): <i>o</i>
438Building a new DOS disklabel.
439</pre>
440
441<p>
442We start with deleting all partitions. The following shows how to delete
443a partition (in the example we use '1'). Repeat the process to delete all
444other partitions.
445</p>
446
447<p>
448Use <c>p</c> to view all existing partitions. <c>d</c> is used to delete a
449partition.
450</p>
451
452<pre caption="Deleting a partition">
453command (m for help): <i>p</i>
454
455Disk /dev/sda: 9150 MB, 9150996480 bytes
45664 heads, 32 sectors/track, 8727 cylinders
457Units = 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
465command (m for help): <i>d</i>
466Partition 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>
477On Alpha systems which use MILO to boot, we have to create a small vfat
478boot partition.
479</p>
480
481<pre caption="Creating the boot partition">
482Command (m for help): <i>n</i>
483Command action
484 e extended
485 p primary partition (1-4)
486<i>p</i>
487Partition number (1-4): <i>1</i>
488First cylinder (1-8727, default 1): <i>1</i>
489Last cylinder or +size or +sizeM or +sizeK (1-8727, default 8727): <i>+16M</i>
490
491Command (m for help): <i>t</i>
492Selected partition 1
493Hex code (type L to list codes): <i>6</i>
494Changed 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>
504We will create a swap partition with a total size of 1 GB. Use <c>n</c> to
505create a new partition.
506</p>
507
508<pre caption="Creating the swap partition">
509Command (m for help): <i>n</i>
510Command action
511 e extended
512 p primary partition (1-4)
513<i>p</i>
514Partition number (1-4): <i>2</i>
515First cylinder (17-8727, default 17): <i>17</i>
516Last cylinder or +size or +sizeM or +sizeK (17-8727, default 8727): <i>+1000M</i>
517
518Command (m for help): <i>t</i>
519Partition number (1-4): <i>2</i>
520Hex code (type L to list codes): <i>82</i>
521Changed system type of partition 2 to 82 (Linux swap)
522</pre>
523
524<p>
525After these steps you should see a layout similar to the following:
526</p>
527
528<pre caption="Partition listing after creating a swap partition">
529Command (m for help): <i>p</i>
530
531Disk /dev/sda: 9150 MB, 9150996480 bytes
53264 heads, 32 sectors/track, 8727 cylinders
533Units = 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>
547We will now create the root partition. Again, just use the <c>n</c> command.
548</p>
549
550<pre caption="Creating the root partition">
551Command (m for help): <i>n</i>
552Command action
553 e extended
554 p primary partition (1-4)
555<i>p</i>
556Partition number (1-4): <i>3</i>
557First cylinder (972-8727, default 972): <i>972</i>
558Last cylinder or +size or +sizeM or +sizeK (972-8727, default 8727): <i>8727</i>
559</pre>
560
561<p>
562After these steps you should see a layout similar to the following:
563</p>
564
565<pre caption="Partition listing after creating the root partition">
566Command (m for help): <i>p</i>
567
568Disk /dev/sda: 9150 MB, 9150996480 bytes
56964 heads, 32 sectors/track, 8727 cylinders
570Units = 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>
585Save <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">
589Command (m for help): <i>w</i>
590</pre>
591
592<p>
593Now that your partitions are created, you can continue with <uri
375link="#filesystems">Creating Filesystems</uri>. 594link="#filesystems">Creating Filesystems</uri>.
376</p> 595</p>
377 596
378</body> 597</body>
379</subsection> 598</subsection>
392Otherwise read on to learn about the available filesystems... 611Otherwise read on to learn about the available filesystems...
393</p> 612</p>
394 613
395</body> 614</body>
396</subsection> 615</subsection>
397<subsection>
398<title>Filesystems?</title>
399<body>
400 616
401<p>
402Several filesystems are available. Most of them are found stable on the
403Alpha architecture.
404</p>
405
406<p>
407<b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
408journaling, which means that routine ext2 filesystem checks at startup time can
409be quite time-consuming. There is now quite a selection of newer-generation
410journaled filesystems that can be checked for consistency very quickly and are
411thus generally preferred over their non-journaled counterparts. Journaled
412filesystems prevent long delays when you boot your system and your filesystem
413happens to be in an inconsistent state.
414</p>
415
416<p>
417<b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
418journaling for fast recovery in addition to other enhanced journaling modes like
419full data and ordered data journaling. ext3 is a very good and reliable
420filesystem. It has an additional hashed b-tree indexing option that enables
421high performance in almost all situations. In short, ext3 is an excellent
422filesystem.
423</p>
424
425<p>
426<b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
427performance and greatly outperforms both ext2 and ext3 when dealing with small
428files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
429extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
430solid and usable as both general-purpose filesystem and for extreme cases such
431as the creation of large filesystems, the use of many small files, very large
432files and directories containing tens of thousands of files.
433</p>
434
435<p>
436<b>XFS</b> is a filesystem with metadata journaling which comes with a robust
437feature-set and is optimized for scalability. We only recommend using this
438filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
439an uninterruptible power supply. Because XFS aggressively caches in-transit data
440in RAM, improperly designed programs (those that don't take proper precautions
441when writing files to disk and there are quite a few of them) can lose a good
442deal of data if the system goes down unexpectedly.
443</p>
444
445<p>
446<b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
447become production-ready and there hasn't been a sufficient track record to
448comment positively nor negatively on its general stability at this point.
449</p>
450
451</body>
452</subsection> 617<subsection>
618<include href="hb-install-filesystems.xml"/>
619</subsection>
620
453<subsection id="filesystems-apply"> 621<subsection id="filesystems-apply">
454<title>Applying a Filesystem to a Partition</title> 622<title>Applying a Filesystem to a Partition</title>
455<body> 623<body>
456 624
457<p> 625<p>
464 <th>Filesystem</th> 632 <th>Filesystem</th>
465 <th>Creation Command</th> 633 <th>Creation Command</th>
466</tr> 634</tr>
467<tr> 635<tr>
468 <ti>ext2</ti> 636 <ti>ext2</ti>
469 <ti><c>mke2fs</c></ti> 637 <ti><c>mkfs.ext2</c></ti>
470</tr> 638</tr>
471<tr> 639<tr>
472 <ti>ext3</ti> 640 <ti>ext3</ti>
473 <ti><c>mke2fs -j</c></ti> 641 <ti><c>mkfs.ext3</c></ti>
642</tr>
643<tr>
644 <ti>ext4</ti>
645 <ti><c>mkfs.ext4</c></ti>
474</tr> 646</tr>
475<tr> 647<tr>
476 <ti>reiserfs</ti> 648 <ti>reiserfs</ti>
477 <ti><c>mkreiserfs</c></ti> 649 <ti><c>mkfs.reiserfs</c></ti>
478</tr> 650</tr>
479<tr> 651<tr>
480 <ti>xfs</ti> 652 <ti>xfs</ti>
481 <ti><c>mkfs.xfs</c></ti> 653 <ti><c>mkfs.xfs</c></ti>
482</tr> 654</tr>
490For instance, to have the root partition (<path>/dev/sda2</path> in our example) 662For instance, to have the root partition (<path>/dev/sda2</path> in our example)
491in ext3, you would use: 663in ext3, you would use:
492</p> 664</p>
493 665
494<pre caption="Applying a filesystem on a partition"> 666<pre caption="Applying a filesystem on a partition">
495# <i>mke2fs -j /dev/sda2</i> 667# <i>mkfs.ext3 /dev/sda2</i>
496</pre> 668</pre>
497 669
498<p> 670<p>
499Now create the filesystems on your newly created partitions (or logical 671Now create the filesystems on your newly created partitions (or logical
500volumes). 672volumes).
521<pre caption="Activating the swap partition"> 693<pre caption="Activating the swap partition">
522# <i>swapon /dev/sda1</i> 694# <i>swapon /dev/sda1</i>
523</pre> 695</pre>
524 696
525<p> 697<p>
526Create and activate the swap now. 698Create and activate the swap with the commands mentioned above.
527</p> 699</p>
528 700
529</body> 701</body>
530</subsection> 702</subsection>
531</section> 703</section>
535 707
536<p> 708<p>
537Now that your partitions are initialized and are housing a filesystem, it is 709Now that your partitions are initialized and are housing a filesystem, it is
538time to mount those partitions. Use the <c>mount</c> command. Don't forget to 710time to mount those partitions. Use the <c>mount</c> command. Don't forget to
539create the necessary mount directories for every partition you created. As an 711create the necessary mount directories for every partition you created. As an
540example we mount the root and boot partition: 712example we mount the root partition:
541</p> 713</p>
542 714
543<pre caption="Mounting partitions"> 715<pre caption="Mounting partitions">
544# <i>mount /dev/sda2 /mnt/gentoo</i> 716# <i>mount /dev/sda2 /mnt/gentoo</i>
545</pre> 717</pre>

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20