/[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.7 Revision 1.30
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.7 2004/08/17 00:01:21 vapier Exp $ --> 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 8
9<sections> 9<sections>
10
11<version>9.1</version>
12<date>2009-02-15</date>
13
10<section> 14<section>
11<title>Introduction to Block Devices</title> 15<title>Introduction to Block Devices</title>
12<subsection>
13<title>Block Devices</title>
14<body>
15 16
16<p>
17We'll take a good look at disk-oriented aspects of Gentoo Linux
18and Linux in general, including Linux filesystems, partitions and block devices.
19Then, once you're familiar with the ins and outs of disks and filesystems,
20you'll be guided through the process of setting up partitions and filesystems
21for your Gentoo Linux installation.
22</p>
23
24<p>
25To begin, we'll introduce <e>block devices</e>. The most famous block device is
26probably the one that represents the first SCSI HD in a Linux system, namely
27<path>/dev/sda</path>.
28</p>
29
30<p>
31The block devices above represent an abstract interface to the disk. User
32programs can use these block devices to interact with your disk without worrying
33about whether your drives are IDE, SCSI or something else. The program can
34simply address the storage on the disk as a bunch of contiguous,
35randomly-accessible 512-byte blocks.
36</p>
37
38</body>
39</subsection> 17<subsection>
18<include href="hb-install-blockdevices.xml"/>
19</subsection>
20
40<subsection> 21<subsection>
41<title>Slices</title> 22<title>Slices</title>
42<body> 23<body>
43 24
44<p> 25<p>
82 63
83 64
84<p> 65<p>
85If 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
86many partitions (or volumes) you need, read on. Otherwise continue now with 67many partitions (or volumes) you need, read on. Otherwise continue now with
87<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>.
88</p> 71</p>
89 72
90</body> 73</body>
91</subsection> 74</subsection>
92<subsection> 75<subsection>
100If you are installing Gentoo to perform as a mailserver, your 83If you are installing Gentoo to perform as a mailserver, your
101<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
102<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
103performance. Gameservers will have a separate <path>/opt</path> as most gaming 86performance. Gameservers will have a separate <path>/opt</path> as most gaming
104servers are installed there. The reason is similar for <path>/home</path>: 87servers are installed there. The reason is similar for <path>/home</path>:
105security 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.
106</p> 91</p>
107 92
108<p> 93<p>
109As 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
110partitions or volumes have the following advantages: 95partitions or volumes have the following advantages:
136</p> 121</p>
137 122
138</body> 123</body>
139</subsection> 124</subsection>
140</section> 125</section>
141<section id="fdisk"> 126<section id="fdisk_SRM">
142<title>Using fdisk on Alpha to Partition your Disk</title> 127<title>Using fdisk to Partition your Disk (SRM only)</title>
143<subsection> 128<subsection>
144<body> 129<body>
145 130
146<p> 131<p>
147The following parts explain how to create the example slice layout described 132The following parts explain how to create the example slice layout described
166 <ti>Full disk (required)</ti> 151 <ti>Full disk (required)</ti>
167</tr> 152</tr>
168</table> 153</table>
169 154
170<p> 155<p>
171Change your slice layout according to your own will. 156Change your slice layout according to your own preference.
172</p> 157</p>
173 158
174 159
175</body> 160</body>
176</subsection> 161</subsection>
210<p> 195<p>
211If 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
212a BSD disklabel. 197a BSD disklabel.
213</p> 198</p>
214 199
215<pre caption="Creating BSD disklabel"> 200<pre caption="Creating a BSD disklabel">
216Command (m for help): <i>b</i> 201Command (m for help): <i>b</i>
217/dev/sda contains no disklabel. 202/dev/sda contains no disklabel.
218Do you want to create a disklabel? (y/n) <i>y</i> 203Do you want to create a disklabel? (y/n) <i>y</i>
219<comment>A bunch of drive-specific info will show here</comment> 204<comment>A bunch of drive-specific info will show here</comment>
2203 partitions: 2053 partitions:
221# start end size fstype [fsize bsize cpg] 206# start end size fstype [fsize bsize cpg]
222 c: 1 5290* 5289* unused 0 0 207 c: 1 5290* 5289* unused 0 0
223</pre> 208</pre>
224 209
225<p> 210<p>
226We 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
227shows 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
228delete 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).
229</p> 215</p>
230 216
231<p> 217<p>
232Use <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.
233</p> 219</p>
268<subsection> 254<subsection>
269<title>Creating the Swap Slice</title> 255<title>Creating the Swap Slice</title>
270<body> 256<body>
271 257
272<p> 258<p>
273On 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
274first 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.
275</p> 261</p>
276 262
277<p> 263<p>
278We 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
279size 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,
280we will change its type to <c>1</c>, meaning <e>swap</e>. 266we will change its type to <c>1</c> (one), meaning <e>swap</e>.
281</p> 267</p>
282 268
283<pre caption="Creating the swap slice"> 269<pre caption="Creating the swap slice">
284BSD disklabel command (m for help): <i>n</i> 270BSD disklabel command (m for help): <i>n</i>
285Partition (a-p): <i>a</i> 271Partition (a-p): <i>a</i>
311<body> 297<body>
312 298
313<p> 299<p>
314We 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>
315the 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
316our 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.
317</p> 303</p>
318 304
319<p> 305<p>
320Another 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
321the 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
322other 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
323number (in this example: 5290) with one. 309number (in this example: 5290) with one.
324</p> 310</p>
325 311
326<p> 312<p>
327When 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>.
328</p> 314</p>
329 315
330<pre caption="Creating the root slice"> 316<pre caption="Creating the root slice">
331D disklabel command (m for help): <i>n</i> 317D disklabel command (m for help): <i>n</i>
332Partition (a-p): <i>b</i> 318Partition (a-p): <i>b</i>
365<pre caption="Save and exit fdisk"> 351<pre caption="Save and exit fdisk">
366Command (m for help): <i>w</i> 352Command (m for help): <i>w</i>
367</pre> 353</pre>
368 354
369<p> 355<p>
370Now 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
371link="#filesystems">Creating Filesystems</uri>. 594link="#filesystems">Creating Filesystems</uri>.
372</p> 595</p>
373 596
374</body> 597</body>
375</subsection> 598</subsection>
388Otherwise read on to learn about the available filesystems... 611Otherwise read on to learn about the available filesystems...
389</p> 612</p>
390 613
391</body> 614</body>
392</subsection> 615</subsection>
393<subsection>
394<title>Filesystems?</title>
395<body>
396 616
397<p>
398Several filesystems are available. Most of them are found stable on the
399Alpha architecture.
400</p>
401
402<p>
403<b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
404journaling, which means that routine ext2 filesystem checks at startup time can
405be quite time-consuming. There is now quite a selection of newer-generation
406journaled filesystems that can be checked for consistency very quickly and are
407thus generally preferred over their non-journaled counterparts. Journaled
408filesystems prevent long delays when you boot your system and your filesystem
409happens to be in an inconsistent state.
410</p>
411
412<p>
413<b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
414journaling for fast recovery in addition to other enhanced journaling modes like
415full data and ordered data journaling. ext3 is a very good and reliable
416filesystem. It has an additional hashed b-tree indexing option that enables
417high performance in almost all situations. In short, ext3 is an excellent
418filesystem.
419</p>
420
421<p>
422<b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
423performance and greatly outperforms both ext2 and ext3 when dealing with small
424files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
425extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
426solid and usable as both general-purpose filesystem and for extreme cases such
427as the creation of large filesystems, the use of many small files, very large
428files and directories containing tens of thousands of files.
429</p>
430
431<p>
432<b>XFS</b> is a filesystem with metadata journaling which comes with a robust
433feature-set and is optimized for scalability. We only recommend using this
434filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
435an uninterruptible power supply. Because XFS aggressively caches in-transit data
436in RAM, improperly designed programs (those that don't take proper precautions
437when writing files to disk and there are quite a few of them) can lose a good
438deal of data if the system goes down unexpectedly.
439</p>
440
441<p>
442<b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
443become production-ready and there hasn't been a sufficient track record to
444comment positively nor negatively on its general stability at this point.
445</p>
446
447</body>
448</subsection> 617<subsection>
618<include href="hb-install-filesystems.xml"/>
619</subsection>
620
449<subsection id="filesystems-apply"> 621<subsection id="filesystems-apply">
450<title>Applying a Filesystem to a Partition</title> 622<title>Applying a Filesystem to a Partition</title>
451<body> 623<body>
452 624
453<p> 625<p>
517<pre caption="Activating the swap partition"> 689<pre caption="Activating the swap partition">
518# <i>swapon /dev/sda1</i> 690# <i>swapon /dev/sda1</i>
519</pre> 691</pre>
520 692
521<p> 693<p>
522Create and activate the swap now. 694Create and activate the swap with the commands mentioned above.
523</p> 695</p>
524 696
525</body> 697</body>
526</subsection> 698</subsection>
527</section> 699</section>
531 703
532<p> 704<p>
533Now that your partitions are initialized and are housing a filesystem, it is 705Now that your partitions are initialized and are housing a filesystem, it is
534time to mount those partitions. Use the <c>mount</c> command. Don't forget to 706time to mount those partitions. Use the <c>mount</c> command. Don't forget to
535create the necessary mount directories for every partition you created. As an 707create the necessary mount directories for every partition you created. As an
536example we mount the root and boot partition: 708example we mount the root partition:
537</p> 709</p>
538 710
539<pre caption="Mounting partitions"> 711<pre caption="Mounting partitions">
540# <i>mount /dev/sda2 /mnt/gentoo</i> 712# <i>mount /dev/sda2 /mnt/gentoo</i>
541</pre> 713</pre>

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.30

  ViewVC Help
Powered by ViewVC 1.1.20