| … | |
… | |
| 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/2.5 --> |
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.22 2006/08/30 22:52:28 nightmorph 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 | |
10 | |
| 11 | <version>7.0</version> |
11 | <version>9.1</version> |
| 12 | <date>2006-08-30</date> |
12 | <date>2009-02-15</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> |
|
|
| 21 | We'll take a good look at disk-oriented aspects of Gentoo Linux |
|
|
| 22 | and Linux in general, including Linux filesystems, partitions and block devices. |
|
|
| 23 | Then, once you're familiar with the ins and outs of disks and filesystems, |
|
|
| 24 | you'll be guided through the process of setting up partitions and filesystems |
|
|
| 25 | for your Gentoo Linux installation. |
|
|
| 26 | </p> |
|
|
| 27 | |
|
|
| 28 | <p> |
|
|
| 29 | To begin, we'll introduce <e>block devices</e>. The most famous block device is |
|
|
| 30 | probably the one that represents the first SCSI HD in a Linux system, namely |
|
|
| 31 | <path>/dev/sda</path>. |
|
|
| 32 | </p> |
|
|
| 33 | |
|
|
| 34 | <p> |
|
|
| 35 | The block devices above represent an abstract interface to the disk. User |
|
|
| 36 | programs can use these block devices to interact with your disk without worrying |
|
|
| 37 | about whether your drives are IDE, SCSI or something else. The program can |
|
|
| 38 | simply address the storage on the disk as a bunch of contiguous, |
|
|
| 39 | randomly-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> |
| … | |
… | |
| 277 | <subsection> |
254 | <subsection> |
| 278 | <title>Creating the Swap Slice</title> |
255 | <title>Creating the Swap Slice</title> |
| 279 | <body> |
256 | <body> |
| 280 | |
257 | |
| 281 | <p> |
258 | <p> |
| 282 | On Alpha based systems you don't need a separate boot partition. However, the |
259 | On Alpha based systems you don't need a separate boot slice. However, the |
| 283 | first cylinder cannot be used as the <c>aboot</c> image will be placed there. |
260 | first cylinder cannot be used as the <c>aboot</c> image will be placed there. |
| 284 | </p> |
261 | </p> |
| 285 | |
262 | |
| 286 | <p> |
263 | <p> |
| 287 | We will create a swap slice starting at the third cylinder, with a total |
264 | We will create a swap slice starting at the third cylinder, with a total |
| … | |
… | |
| 320 | <body> |
297 | <body> |
| 321 | |
298 | |
| 322 | <p> |
299 | <p> |
| 323 | We will now create the root slice, starting from the first cylinder <e>after</e> |
300 | We will now create the root slice, starting from the first cylinder <e>after</e> |
| 324 | the swap slice. Use the <c>p</c> command to view where the swap slice ends. In |
301 | the swap slice. Use the <c>p</c> command to view where the swap slice ends. In |
| 325 | our example, this is at 1003, making the root partition start at 1004. |
302 | our example, this is at 1003, making the root slice start at 1004. |
| 326 | </p> |
303 | </p> |
| 327 | |
304 | |
| 328 | <p> |
305 | <p> |
| 329 | Another problem is that there is currently a bug in <c>fdisk</c> making it think |
306 | Another problem is that there is currently a bug in <c>fdisk</c> making it think |
| 330 | the number of available cylinders is one above the real number of cylinders. In |
307 | the number of available cylinders is one above the real number of cylinders. In |
| 331 | other words, when you are asked for the last cylinder, decrease the cylinder |
308 | other words, when you are asked for the last cylinder, decrease the cylinder |
| 332 | number (in this example: 5290) with one. |
309 | number (in this example: 5290) with one. |
| 333 | </p> |
310 | </p> |
| 334 | |
311 | |
| 335 | <p> |
312 | <p> |
| 336 | When the partition is created, we change the type to <c>8</c>, for <e>ext2</e>. |
313 | When the slice is created, we change the type to <c>8</c>, for <e>ext2</e>. |
| 337 | </p> |
314 | </p> |
| 338 | |
315 | |
| 339 | <pre caption="Creating the root slice"> |
316 | <pre caption="Creating the root slice"> |
| 340 | D disklabel command (m for help): <i>n</i> |
317 | D disklabel command (m for help): <i>n</i> |
| 341 | Partition (a-p): <i>b</i> |
318 | Partition (a-p): <i>b</i> |
| … | |
… | |
| 374 | <pre caption="Save and exit fdisk"> |
351 | <pre caption="Save and exit fdisk"> |
| 375 | Command (m for help): <i>w</i> |
352 | Command (m for help): <i>w</i> |
| 376 | </pre> |
353 | </pre> |
| 377 | |
354 | |
| 378 | <p> |
355 | <p> |
| 379 | Now that your slices are created, you can now continue with <uri |
356 | Now that your slices are created, you can continue with <uri |
| 380 | link="#filesystems">Creating Filesystems</uri>. |
357 | link="#filesystems">Creating Filesystems</uri>. |
| 381 | </p> |
358 | </p> |
| 382 | |
359 | |
| 383 | </body> |
360 | </body> |
| 384 | </subsection> |
361 | </subsection> |
| … | |
… | |
| 522 | <subsection> |
499 | <subsection> |
| 523 | <title>Creating the Swap Partition</title> |
500 | <title>Creating the Swap Partition</title> |
| 524 | <body> |
501 | <body> |
| 525 | |
502 | |
| 526 | <p> |
503 | <p> |
| 527 | We will create a swap partition starting at the third cylinder, with a total |
504 | We will create a swap partition with a total size of 1 GB. Use <c>n</c> to |
| 528 | size of 1 GB. Use <c>n</c> to create a new partition. |
505 | create a new partition. |
| 529 | </p> |
506 | </p> |
| 530 | |
507 | |
| 531 | <pre caption="Creating the swap partition"> |
508 | <pre caption="Creating the swap partition"> |
| 532 | Command (m for help): <i>n</i> |
509 | Command (m for help): <i>n</i> |
| 533 | Command action |
510 | Command action |
| … | |
… | |
| 537 | Partition number (1-4): <i>2</i> |
514 | Partition number (1-4): <i>2</i> |
| 538 | First cylinder (17-8727, default 17): <i>17</i> |
515 | First cylinder (17-8727, default 17): <i>17</i> |
| 539 | Last cylinder or +size or +sizeM or +sizeK (17-8727, default 8727): <i>+1000M</i> |
516 | Last cylinder or +size or +sizeM or +sizeK (17-8727, default 8727): <i>+1000M</i> |
| 540 | |
517 | |
| 541 | Command (m for help): <i>t</i> |
518 | Command (m for help): <i>t</i> |
| 542 | Partition number (1-4): <i>1</i> |
519 | Partition number (1-4): <i>2</i> |
| 543 | Hex code (type L to list codes): <i>82</i> |
520 | Hex code (type L to list codes): <i>82</i> |
| 544 | Changed system type of partition 2 to 82 (Linux swap) |
521 | Changed system type of partition 2 to 82 (Linux swap) |
| 545 | </pre> |
522 | </pre> |
| 546 | |
523 | |
| 547 | <p> |
524 | <p> |
| … | |
… | |
| 611 | <pre caption="Save and exit fdisk"> |
588 | <pre caption="Save and exit fdisk"> |
| 612 | Command (m for help): <i>w</i> |
589 | Command (m for help): <i>w</i> |
| 613 | </pre> |
590 | </pre> |
| 614 | |
591 | |
| 615 | <p> |
592 | <p> |
| 616 | Now that your partitions are created, you can now continue with <uri |
593 | Now that your partitions are created, you can continue with <uri |
| 617 | link="#filesystems">Creating Filesystems</uri>. |
594 | link="#filesystems">Creating Filesystems</uri>. |
| 618 | </p> |
595 | </p> |
| 619 | |
596 | |
| 620 | </body> |
597 | </body> |
| 621 | </subsection> |
598 | </subsection> |
| … | |
… | |
| 634 | Otherwise read on to learn about the available filesystems... |
611 | Otherwise read on to learn about the available filesystems... |
| 635 | </p> |
612 | </p> |
| 636 | |
613 | |
| 637 | </body> |
614 | </body> |
| 638 | </subsection> |
615 | </subsection> |
| 639 | <subsection> |
|
|
| 640 | <title>Filesystems?</title> |
|
|
| 641 | <body> |
|
|
| 642 | |
616 | |
| 643 | <p> |
|
|
| 644 | Several filesystems are available. Most of them are found stable on the |
|
|
| 645 | Alpha architecture. |
|
|
| 646 | </p> |
|
|
| 647 | |
|
|
| 648 | <note> |
|
|
| 649 | <c>aboot</c> only supports booting from <b>ext2</b> and <b>ext3</b> |
|
|
| 650 | partitions. |
|
|
| 651 | </note> |
|
|
| 652 | |
|
|
| 653 | <p> |
|
|
| 654 | <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata |
|
|
| 655 | journaling, which means that routine ext2 filesystem checks at startup time can |
|
|
| 656 | be quite time-consuming. There is now quite a selection of newer-generation |
|
|
| 657 | journaled filesystems that can be checked for consistency very quickly and are |
|
|
| 658 | thus generally preferred over their non-journaled counterparts. Journaled |
|
|
| 659 | filesystems prevent long delays when you boot your system and your filesystem |
|
|
| 660 | happens to be in an inconsistent state. |
|
|
| 661 | </p> |
|
|
| 662 | |
|
|
| 663 | <p> |
|
|
| 664 | <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata |
|
|
| 665 | journaling for fast recovery in addition to other enhanced journaling modes like |
|
|
| 666 | full data and ordered data journaling. ext3 is a very good and reliable |
|
|
| 667 | filesystem. |
|
|
| 668 | </p> |
|
|
| 669 | |
|
|
| 670 | <p> |
|
|
| 671 | <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall |
|
|
| 672 | performance and greatly outperforms both ext2 and ext3 when dealing with small |
|
|
| 673 | files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales |
|
|
| 674 | extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is |
|
|
| 675 | solid and usable as both general-purpose filesystem and for extreme cases such |
|
|
| 676 | as the creation of large filesystems, the use of many small files, very large |
|
|
| 677 | files and directories containing tens of thousands of files. |
|
|
| 678 | </p> |
|
|
| 679 | |
|
|
| 680 | <p> |
|
|
| 681 | <b>XFS</b> is a filesystem with metadata journaling which comes with a robust |
|
|
| 682 | feature-set and is optimized for scalability. We only recommend using this |
|
|
| 683 | filesystem on Linux systems with high-end SCSI and/or fibre channel storage and |
|
|
| 684 | an uninterruptible power supply. Because XFS aggressively caches in-transit data |
|
|
| 685 | in RAM, improperly designed programs (those that don't take proper precautions |
|
|
| 686 | when writing files to disk and there are quite a few of them) can lose a good |
|
|
| 687 | deal of data if the system goes down unexpectedly. |
|
|
| 688 | </p> |
|
|
| 689 | |
|
|
| 690 | <p> |
|
|
| 691 | <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently |
|
|
| 692 | become production-ready and there hasn't been a sufficient track record to |
|
|
| 693 | comment positively nor negatively on its general stability at this point. |
|
|
| 694 | </p> |
|
|
| 695 | |
|
|
| 696 | </body> |
|
|
| 697 | </subsection> |
617 | <subsection> |
|
|
618 | <include href="hb-install-filesystems.xml"/> |
|
|
619 | </subsection> |
|
|
620 | |
| 698 | <subsection id="filesystems-apply"> |
621 | <subsection id="filesystems-apply"> |
| 699 | <title>Applying a Filesystem to a Partition</title> |
622 | <title>Applying a Filesystem to a Partition</title> |
| 700 | <body> |
623 | <body> |
| 701 | |
624 | |
| 702 | <p> |
625 | <p> |
| … | |
… | |
| 780 | |
703 | |
| 781 | <p> |
704 | <p> |
| 782 | Now that your partitions are initialized and are housing a filesystem, it is |
705 | Now that your partitions are initialized and are housing a filesystem, it is |
| 783 | time to mount those partitions. Use the <c>mount</c> command. Don't forget to |
706 | time to mount those partitions. Use the <c>mount</c> command. Don't forget to |
| 784 | create the necessary mount directories for every partition you created. As an |
707 | create the necessary mount directories for every partition you created. As an |
| 785 | example we mount the root and boot partition: |
708 | example we mount the root partition: |
| 786 | </p> |
709 | </p> |
| 787 | |
710 | |
| 788 | <pre caption="Mounting partitions"> |
711 | <pre caption="Mounting partitions"> |
| 789 | # <i>mount /dev/sda2 /mnt/gentoo</i> |
712 | # <i>mount /dev/sda2 /mnt/gentoo</i> |
| 790 | </pre> |
713 | </pre> |