Vorbereiten der Festplatte(n)

From Gentoo Wiki
Jump to: navigation, search
This page is a translated version of the page Handbook:AMD64/Installation/Disks and the translation is 100% complete.

Other languages:
Deutsch • ‎English • ‎Türkçe • ‎español • ‎français • ‎italiano • ‎polski • ‎português do Brasil • ‎čeština • ‎русский • ‎українська • ‎中文(中国大陆)‎ • ‎日本語 • ‎한국어
AMD64 Handbook
About the installation
Choosing the media
Configuring the network
Preparing the disks
Installing stage3
Installing base system
Configuring the kernel
Configuring the system
Installing tools
Configuring the bootloader
Working with Gentoo
Portage introduction
USE flags
Portage features
Initscript system
Environment variables
Working with Portage
Files and directories
Mixing software branches
Additional tools
Custom package repository
Advanced features
Network configuration
Getting started
Advanced configuration
Modular networking
Adding functionality
Dynamic management

Einführung in blockorientierte Geräte

Blockorientierte Geräte

Let's take a good look at disk-oriented aspects of Gentoo Linux and Linux in general, including Linux filesystems, partitions, and block devices. Once the ins and outs of disks and filesystems are understood, partitions and filesystems can be established for the Gentoo Linux installation.

To begin, let's look at block devices. The most famous block device is probably the one that represents the first drive in a Linux system, namely /dev/sda. SCSI and Serial ATA drives are both labeled /dev/sd*; even IDE drives are labeled /dev/sd* with the libata framework in the kernel. When using the old device framework, then the first IDE drive is /dev/hda.

The block devices above represent an abstract interface to the disk. User programs can use these block devices to interact with the disk without worrying about whether the drives are IDE, SCSI, or something else. The program can simply address the storage on the disk as a bunch of contiguous, randomly-accessible 512-byte blocks.

Partition tables

Although it is theoretically possible to use a raw, unpartitioned disk to house a Linux system (when creating a btrfs RAID for example), this is almost never done in practice. Instead, disk block devices are split up into smaller, more manageable block devices. On amd64 systems, these are called partitions. There are currently two standard partitioning technologies in use: MBR and GPT.


Das MBR (Master Boot Record) Setup verwendet 32-Bit Kennzeichner für den Start der Sektoren und die Länge der Partitionen. Drei Partitionstypen werden unterstützt: primär, erweitert und logisch. Primäre Partitionen speichern ihre Informationen im Master Boot Record selbst - ein sehr kleiner Bereich (meist 512 Bytes) ganz am Anfang der Festplatte. Aufgrund des geringen Platzes werden nur vier Primäre Partitionen unterstützt (beispielsweise /dev/sda1 bis /dev/sda4).

Um mehr Partitionen zu unterstützen, kennzeichnen Sie eine der primären Partitionen als erweitert. Diese Partition kann dann logische Partitionen beinhalten (Partitionen in einer Partition).

Although still supported by most motherboard manufacturers partition tables are considered legacy. Unless working with hardware that is pre-2010, it best to partition a disk using a GUID Partition Table. Readers who must proceed with MBR should acknowledge the following information:
  • Most post-2010 motherboards consider MBR a legacy (supported, but not ideal) boot mode.
  • Due to using 32-bit identifiers, master boot record partitioning tables cannot handle disks that are greater than 2 TiBs in size.
  • Unless a extended partition is created, MBR supports a maximum of four partitions.
  • The MBR setup does not provide any backup-MBR, so if an application or user overwrites the MBR, all partition information is lost.

The Handbook authors suggest using GPT whenever possible for Gentoo installations.


The GPT (GUID Partition Table) setup uses 64-bit identifiers for the partitions. The location in which it stores the partition information is much bigger than the 512 bytes of an MBR, which means there is practically no limit on the amount of partitions for a GPT disk. Also the size of a partition is bounded by a much greater limit (almost 8 ZiB - yes, zettabytes).

When a system's software interface between the operating system and firmware is UEFI (instead of BIOS), GPT is almost mandatory as compatibility issues will arise with MBR.

GPT also takes advantage of checksumming and redundancy. It carries CRC32 checksums to detect errors in the header and partition tables and has a backup GPT at the end of the disk. This backup table can be used to recover damage of the primary GPT near the beginning of the disk.

GPT oder MBR

From the description above, one might think that using GPT should always be the recommended approach, however there are a few caveats.

Using GPT on a BIOS-based computer works, but then one cannot dual-boot with a Microsoft Windows operating system. The reason is that Microsoft Windows will boot in UEFI mode if it detects a GPT partition label.

Some buggy motherboard firmware configured to boot in BIOS/CSM/legacy mode might also have problems with booting from GPT labeled disks. If that is the case, it might be possible to work around the problem by adding the boot/active flag on the protective MBR partition which has to be done through fdisk with the -t dos option to force it to read the partition table using the MBR format.

In this case, launch fdisk and toggle the flag using the a key. Press 1 to select the first partition, then press the w key to write the changes to the disk and exit the fdisk application:

user $fdisk -t dos /dev/sda
Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): a
Partition number (1-4): 1
Command (m for help): w

Using UEFI

When installing Gentoo on a system that uses UEFI to boot the operating system (instead of BIOS), then it is important that an EFI System Partition (ESP) is created. The instructions for parted below contain the necessary pointers to correctly handle this operation.

The ESP must be a FAT variant (sometimes shown as vfat on Linux systems). The official UEFI specification denotes FAT12, 16, or 32 filesystems will be recognized by the UEFI firmware, although FAT32 is recommended for the ESP. Proceed in formatting the ESP as FAT32:

root #mkfs.fat -F 32 /dev/sda2
If a FAT variant is not used for the ESP, the system's UEFI firmware is not guaranteed to find the bootloader (or Linux kernel) and most likely be unable to boot the system!

Erweiterte Speichermöglichkeit

Btrfs RAID

As noted above, btrfs has the ability to create filesystems across multiple devices. Btrfs filesystems generated in this way can act in the following modes: raid0, raid1, raid10, raid5, and raid6. RAID modes 5 and 6 have improved considerably, but are still considered unstable. After a multiple device filesystem has been created, new devices can be added and old devices removed in a few commands. Btrfs takes more involvement than other filesystems making it not as friendly to beginners.

ext4 filesytems can be converted into btrfs filesystems, which may be useful for those who'd like to install Gentoo with a stable, well tested filesystem and gradually increase their knowledge about newer filesystems such as btrfs by experimentation.


The amd64 Installation CDs provide support for Logical Volume Manager (LVM). LVM increases the flexibility offered by the partitioning setup. The installation instructions below will focus on "regular" partitions, but it is good to know LVM is supported if that route is desired. Visit the LVM article for more details. Newcomers beware: although fully supported LVM is outside the scope of this guide.


Throughout the remainder of the handbook, the following partitioning scheme will be used as a simple example layout:

Partition Filesystem Size Description
/dev/sda1 (bootloader) 2M BIOS boot partition
/dev/sda2 ext2 (or fat32 if UEFI is being used) 128M Boot/EFI system partition
/dev/sda3 (swap) 512M or higher Swap partition
/dev/sda4 ext4 Rest of the disk Root partition

If this suffices and the reader going the GPT route they can immediately jump to Default: Using parted to partition the disk. Those who are still interested in MBR (hey - it happens!) and using the example layout can jump to Alternative: Using fdisk to partition the disk.

Both fdisk and parted are partitioning utilities. fdisk is well known, stable, and recommended for the MBR partition layout while parted was one of the first Linux block device management utilities to support GPT partitions. Those who like the user interface of fdisk can use gdisk (GPT fdisk) as an alternative to parted.

Before going to the creation instructions, the first set of sections will describe in more detail how partitioning schemes can be created and mention some common pitfalls.

Entwurf Partitionsschema

How many partitions and how big?

The number of partitions is highly dependent on the environment. For instance, if there are lots of users, then it is advised to have /home/ separate as it increases security and makes backups easier. If Gentoo is being installed to perform as a mail server, then /var/ should be separate as all mails are stored inside /var/. A good choice of filesystem will then maximize the performance. Game servers will have a separate /opt/ as most gaming servers are installed there. The reason is similar for the /home/ directory: security and backups. In most situations, /usr/ is to be kept big: not only will it contain the majority of applications, it typically also hosts the Gentoo ebuild repository (by default located at /usr/portage) which already takes around 650 MiB. This disk space estimate excludes the packages/ and distfiles/ directories that are generally stored within this ebuild repository.

It very much depends on what the administrator wants to achieve. Separate partitions or volumes have the following advantages:

  • Choose the best performing filesystem for each partition or volume.
  • The entire system cannot run out of free space if one defunct tool is continuously writing files to a partition or volume.
  • If necessary, file system checks are reduced in time, as multiple checks can be done in parallel (although this advantage is more with multiple disks than it is with multiple partitions).
  • Security can be enhanced by mounting some partitions or volumes read-only, nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.

Jedoch haben viele Partitionen auch Nachteile. Wenn diese schlecht auf das System angepasst sind, hat dieses viel freien Speicherplatz auf einer Partition und keinen auf einer Anderen mehr übrig. Ein weiterer Nachteil besteht darin, dass separate Partitionen - vor allem für wichtige Mount-Pfade wie /usr/ oder /var/ - es notwendig ein initramfs während des Bootens zu benutzen, welches diese Partitionen vor der Ausführung anderer Bootskripte mountet.

Weiterhin gibt es ein Limit von maximal 15 Partitionen für SCSI und SATA Datenträger, es sei denn der Datenträger nutzt GPT-labels.

What about swap space?

Die perfekte Größe für eine Swap-Partition gibt es nicht. Der Zweck von Swap-Speicher es ist Festplattenspeicherplatz für den Kernel bereitzuhalten, wenn der interne Speicher (RAM) knapp wird. Der Swap-Speicher erlaubt dem Kernel Speicherseiten auf die vermutlich nicht bald zugegriffen wird auf die Platte auszulagern (Swap oder Page-Out) um Arbeitsspeicher freizumachen. Wird der Speicherinhalt plötzlich benötigt, müssen diese Speicherseiten (Pages) wieder zurück in den Arbeitsspeicher geladen werden (Page-In), dies dauert eine Weile (da Festplatten verglichen mit Arbeitsspeicher sehr langsam sind).

When the system is not going to run memory intensive applications or the system has lots of memory available, then it probably does not need much swap space. However, swap space is also used to store the entire memory in case of hibernation. If the system is going to need hibernation, then a bigger swap space is necessary, often at least the amount of memory installed in the system.

What is the BIOS boot partition?

Eine BIOS Bootpartition ist eine sehr kleine Partition (1 bis 2 MB) in welcher Bootloader wie GRUB2 zusätzliche Daten ablegen können, die nicht in den zugeordneten Speicher passen (einige hundert Bytes im Fall des MBR) und die nirgendwo anders platziert werden können.

Solche Partitionen sind nicht immer notwendig, aber in Anbetracht des geringen Platzverbrauchs und der Schwierigkeiten die wir ansonsten mit der Dokumentation einer Fülle unterschiedlicher Partitionierungen hätten, ist es in jedem Fall empfehlenswert sie zu erstellen.

Der Vollständigkeit wegen: Die BIOS Boot Partition ist erforderlich, wenn ein GPT Partitions-Layout mit GRUB2 verwendet wird, oder wenn das MBP Partitions-Layout mit GRUB2 verwendet wird und die erste Partiton vor der 1 MB Marke auf der Festplatte beginnt.

Standard: parted

In diesem Kapitel verwenden wird das Patitions-Layout, das bereits in der Anleitung erwähnt wurde:

Partition Description
/dev/sda1 BIOS boot partition
/dev/sda2 Boot partition
/dev/sda3 Swap partition
/dev/sda4 Root partition

Ändern Sie das Partitions-Layout Ihren persönlichen Vorstellungen entsprechend.

Anzeigen des Partitions-Layouts

The parted application offers a simple interface for partitioning the disks and supports very large partitions (more than 2 TB). Fire up parted against the disk (in our example, we use /dev/sda). It is recommended to ask parted to use optimal partition alignment:

root #parted -a optimal /dev/sda
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.

Ausrichtung bedeutet, dass Partitionen an bekannten Grenzen innerhalb der Festplatte beginnen. Dies soll sicherstellen dass Vorgänge auf der Festplatte von der Betriebssystemebene (Abruf von Speicherseiten von der Festplatte) die geringste Anzahl an internen Festplatten-Operationen verwenden. Falsch ausgerichtete Partitionen könnten es erfordern, dass die Festplatte zwei anstelle von einer Speicherseite abrufen muss, obwohl das Betriebssystem nur eine Speicherseite anfordert.

To find out about all options supported by parted, type help and press return.

GPT Label einstellen

Most disks on the x86 or amd64 architectures are prepared using an msdos label. Using parted, the command to put a GPT label on the disk is mklabel gpt:

Eine Änderung des Partitions-Typs löscht alle Partitionen von der Festplatte. Alle Daten auf der Festplatte gehen dabei verloren.
(parted)mklabel gpt

To have the disk with MBR layout, use mklabel msdos.

Löschen aller Partitionen

If this isn't done yet (for instance through the mklabel operation earlier, or because the disk is a freshly formatted one), first remove all existing partitions from the disk. Type print to view the current partitions, and rm <N> where <N> is the number of the partition to remove.

(parted)rm 2

Do the same for all other partitions that aren't needed. However, make sure to not make any mistakes here - parted executes the changes immediately (unlike fdisk which stages them, allowing a user to "undo" his changes before saving or exiting fdisk).

Partition erstellen

Now parted will be used to create the partitions with the following settings:

  • Den zu verwendenden Partitionstyp. Dieser ist in der Regel primär. Wenn das msdos Partitions-Label verwendet wird denken Sie daran, dass es nicht mehr als 4 primäre Partitionen geben kann. Wenn mehr als 4 Partitionen benötigt werden, muss eine der ersten vier Partitionen erweitert sein. In dieser lassen sich weite Partitionen anlegen, die vom Typ logisch sind.
  • Der Startpunkt einer Partition (kann ausgedrückt werden in MB, GB, ...)
  • Der Endpunkt der Partition (kann ausgedrückt werden in MB, GB, ...)

Zuerst sagen Sie parted, dass die Größeneinheit in der wir arbeiten Megabyte ist (eigentlich Mebibyte, abgekürzt mit MiB das die "Standard"-Notation ist, aber wir werden im Text dennoch durchgängig MB verwenden da es viel gebräuchlicher ist):

(parted)unit mib

Now create a 2 MB partition that will be used by the GRUB2 boot loader later. Use the mkpart command for this, and inform parted to start from 1 MB and end at 3 MB (creating a partition of 2 MB in size).

(parted)mkpart primary 1 3
(parted)name 1 grub
(parted)set 1 bios_grub on
Model: Virtio Block Device (virtblk)
Disk /dev/sda: 20480MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number   Start      End      Size     File system  Name   Flags
 1       1.00MiB    3.00MiB  2.00MiB               grub   bios_grub

Machen Sie das Gleiche für die Boot Partition (128 MB), Swap Partition (im Beispiel 512 MB) und der Root Partition, die die verbleibende Festplatte umspannt (für das die Endmarke als -1 anzugeben ist; Dies bedeutet das Ende der Festplatte minus ein MB, was das Weiteste ist bis wohin eine Partition gehen kann).

(parted)mkpart primary 3 131
(parted)name 2 boot
(parted)mkpart primary 131 643
(parted)name 3 swap
(parted)mkpart primary 643 -1
(parted)name 4 rootfs

Wenn Sie das UEFI Interface zum Booten des Systems nutzen (anstelle des BIOS), kennzeichnen Sie die Boot Partition als EFI System-Partition. Parted macht das automatisch, wenn die boot Option auf eine Partition angewendet wird:

(parted)set 2 boot on

Das Endergebnis sieht so aus:

Model: Virtio Block Device (virtblk)
Disk /dev/sda: 20480MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number   Start      End      Size     File system  Name   Flags
 1       1.00MiB    3.00MiB  2.00MiB               grub   bios_grub
 2       3.00MiB    131MiB   128MiB                boot   boot
 3       131MiB     643MiB   512MiB                swap
 4       643MiB     20479MiB 19836MiB              rootfs
On an UEFI installation, the boot and esp flags will show up on the boot partition.

Use the quit command to exit parted.

Alternative: fdisk

Although recent fdisk should support GPT, it has still shown to have some issues with it. The instructions given below assume that the partition layout being used is MBR.

The following parts explain how to create the example partition layout using fdisk. The example partition layout was mentioned earlier:

Partition Description
/dev/sda1 BIOS boot partition
/dev/sda2 Boot partition
/dev/sda3 Swap partition
/dev/sda4 Root partition

Ändern Sie das Partitions-Layout Ihren Vorstellungen entsprechen ab.

Anzeigen des Partitions-Layouts

fdisk is a popular and powerful tool to split a disk into partitions. Fire up fdisk against the disk (in our example, we use /dev/sda):

root #fdisk /dev/sda
To use GPT support, add -t gpt. It is recommended to closely investigate the fdisk output in case more recent developments in fdisk change its default behavior of defaulting to MBR. The remainder of the instructions assume an MBR layout.

Use the p key to display the disk's current partition configuration:

Command (m for help):p
Disk /dev/sda: 240 heads, 63 sectors, 2184 cylinders
Units = cylinders of 15120 * 512 bytes
   Device Boot    Start       End    Blocks   Id  System
/dev/sda1   *         1        14    105808+  83  Linux
/dev/sda2            15        49    264600   82  Linux swap
/dev/sda3            50        70    158760   83  Linux
/dev/sda4            71      2184  15981840    5  Extended
/dev/sda5            71       209   1050808+  83  Linux
/dev/sda6           210       348   1050808+  83  Linux
/dev/sda7           349       626   2101648+  83  Linux
/dev/sda8           627       904   2101648+  83  Linux
/dev/sda9           905      2184   9676768+  83  Linux

This particular disk was configured to house seven Linux filesystems (each with a corresponding partition listed as "Linux") as well as a swap partition (listed as "Linux swap").

Löschen aller Partitionen

Löschen Sie zuerst alle existierenden Partitionen von der Festplatte. Drücken Sie d um eine Partition zu löschen. Zum Löschen einer vorhandenen Partition /dev/sda1:

Command (m for help):d
Partition number (1-4): 1

The partition has now been scheduled for deletion. It will no longer show up when printing the list of partitions (p, but it will not be erased until the changes have been saved. This allows users to abort the operation if a mistake was made - in that case, type q immediately and hit Enter and the partition will not be deleted.

Drücken Sie wiederholt p um die Partitionsliste anzuzeigen gefolgt von d und der Nummer der zu löschenden Patrition. Schließlich wird die Partitionstabelle leer sein:

Command (m for help):p
Disk /dev/sda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
Device Boot    Start       End    Blocks   Id  System

Jetzt, da die Partitionstabelle im Speicher leer ist, sind wir bereit die Partitionen zu erstellen.

BIOS Boot Partition erstellen

First create a very small BIOS boot partition. Type n to create a new partition, then p to select a primary partition, followed by 1 to select the first primary partition. When prompted for the first sector, make sure it starts from 2048 (which is needed for the boot loader) and hit Enter. When prompted for the last sector, type +2M to create a partition 2 Mbyte in size:

Der Beginn bei Sektor 2048 ist eine Absicherung im Falle, dass der Bootloader diese Partition nicht für deren Nutzung erkennt.
Command (m for help):n
Command action
  e   extended
  p   primary partition (1-4)
Partition number (1-4): 1
First sector (64-10486533532, default 64): 2048
Last sector, +sectors +size{M,K,G} (4096-10486533532, default 10486533532): +2M

Mark the partition for UEFI purposes:

Command (m for help):t
Selected partition 1
Hex code (type L to list codes): 4
Changed system type of partition 1 to 4 (BIOS boot)
Using UEFI with MBR partition layout is discouraged. If an UEFI capable system is used, please use GPT layout.

Boot Partition erstellen

Erstellen Sie nun eine kleine Boot Partition. Drücken Sie n für neue Partition, dann p für primäre Partition, gefolgt von 2 um die zweite Primäre Partition zu erstellen. Wenn Sie aufgefordert werden den ersten Sektor einzugeben, bestätigen Sie die Voreinstellung durch Enter. Wenn Sie nach dem letzten Sektor gefragt werden geben Sie +128M ein, um eine 128 MB große Partition zu erstellen:

Command (m for help):n
Command action
  e   extended
  p   primary partition (1-4)
Partition number (1-4): 2
First sector (5198-10486533532, default 5198): (Hit enter)
Last sector, +sectors +size{M,K,G} (4096-10486533532, default 10486533532): +128M

Wenn Sie nun p drücken, wird die folgende Partitionstabelle angezeigt:

Command (m for help):p
Disk /dev/sda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
   Device Boot    Start       End    Blocks   Id  System
/dev/sda1             1         3      5198+  ef  EFI (FAT-12/16/32)
/dev/sda2             3        14    105808+  83  Linux

Drücken Sie a um das Boot-Flag der Partition zu aktivieren und wählen Sie 2. Achten Sie darauf, dass nach dem nochmaligen Drücken von p ein * in der "Boot"-Spalte platziert ist.

Swap Partition erstellen

Um die Swap Partition zu erstellen, drücken Sie n für neue Partition, dann p für primäre Partition und schließlich 3 um die dritte primäre Partition /dev/sda3 zu erstellen. Wenn Sie aufgefordert werden den ersten Sektor einzugeben, bestätigen Sie die Voreinstellung durch Enter. Wenn Sie nach dem letzten Sektor gefragt werden geben Sie +512M ein (oder jede andere Größe die Sie als Swap-Speicherplatz benötigen), um eine 512 MB große Partition zu erstellen.

Nachdem dies erledigt ist, drücken Sie t um den Partitionstyp einzustellen, 3 um die gerade erzeugte Partition auszuwählen und geben Sie 82 ein um den Partitionstyp auf "Linux Swap" zu setzen.

Root Partition erstellen

Finally, to create the root partition, type n to create a new partition, then p to tell fdisk to create a primary partition. Then type 4 to create the fourth primary partition, /dev/sda4. When prompted for the first sector, hit Enter. When prompted for the last sector, hit Enter to create a partition that takes up the rest of the remaining space on the disk. After completing these steps, typing p should display a partition table that looks similar to this:

Command (m for help):p
Disk /dev/sda: 30.0 GB, 30005821440 bytes
240 heads, 63 sectors/track, 3876 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes
   Device Boot    Start       End    Blocks   Id  System
/dev/sda1             1         3      5198+  ef  EFI (FAT-12/16/32)
/dev/sda2   *         3        14    105808+  83  Linux
/dev/sda3            15        81    506520   82  Linux swap
/dev/sda4            82      3876  28690200   83  Linux

Partitions-Layout speichern

To save the partition layout and exit fdisk, type w.

Command (m for help):w

Mit den erstellten Partitionen, ist es jetzt an der Zeit Dateisysteme darauf anzulegen.

Erstellung von Dateisystemen


Now that the partitions are created, it is time to place a filesystem on them. In the next section the various file systems that Linux supports are described. Readers that already know which filesystem to use can continue with Applying a filesystem to a partition. The others should read on to learn about the available filesystems...


Several filesystems are available. Some of them are found stable on the amd64 architecture - it is advised to read up on the filesystems and their support state before selecting a more experimental one for important partitions.

A next generation filesystem that provides many advanced features such as snapshotting, self-healing through checksums, transparent compression, subvolumes and integrated RAID. A few distributions have begun to ship it as an out-of-the-box option, but it is not production ready. Reports of filesystem corruption are common. Its developers urge people to run the latest kernel version for safety because the older ones have known problems. This has been the case for years and it is too early to tell if things have changed. Fixes for corruption issues are rarely backported to older kernels. Proceed with caution when using this filesystem!
This is the tried and true Linux filesystem but doesn't have metadata journaling, which means that routine ext2 filesystem checks at startup time can be quite time-consuming. There is now quite a selection of newer-generation journaled filesystems that can be checked for consistency very quickly and are thus generally preferred over their non-journaled counterparts. Journaled filesystems prevent long delays when the system is booted and the filesystem happens to be in an inconsistent state.
The journaled version of the ext2 filesystem, providing metadata journaling for fast recovery in addition to other enhanced journaling modes like full data and ordered data journaling. It uses an HTree index that enables high performance in almost all situations. In short, ext3 is a very good and reliable filesystem.
Initially created as a fork of ext3, ext4 brings new features, performance improvements, and removal of size limits with moderate changes to the on-disk format. It can span volumes up to 1 EB and with maximum file size of 16TB. Instead of the classic ext2/3 bitmap block allocation ext4 uses extents, which improve large file performance and reduce fragmentation. Ext4 also provides more sophisticated block allocation algorithms (delayed allocation and multiblock allocation) giving the filesystem driver more ways to optimize the layout of data on the disk. Ext4 is the recommended all-purpose all-platform filesystem.
The Flash-Friendly File System was originally created by Samsung for the use with NAND flash memory. As of Q2, 2016, this filesystem is still considered immature, but it is a decent choice when installing Gentoo to microSD cards, USB drives, or other flash-based storage devices.
IBM's high-performance journaling filesystem. JFS is a light, fast and reliable B+tree-based filesystem with good performance in various conditions.
A B+tree-based journaled filesystem that has good overall performance, especially when dealing with many tiny files at the cost of more CPU cycles. ReiserFS appears to be less maintained than other filesystems.
A filesystem with metadata journaling which comes with a robust feature-set and is optimized for scalability. XFS seems to be less forgiving to various hardware problems.
Also known as FAT32, is supported by Linux but does not support any permission settings. It is mostly used for interoperability with other operating systems (mainly Microsoft Windows) but is also a necessity for some system firmware (like UEFI).
This "New Technology" filesystem is the flagship filesystem of Microsoft Windows. Similar to vfat above it does not store permission settings or extended attributes necessary for BSD or Linux to function properly, therefore it cannot be used as a root filesystem. It should only be used for interoperability with Microsoft Windows systems (note the emphasis on only).

When using ext2, ext3, or ext4 on a small partition (less than 8GB), then the file system must be created with the proper options to reserve enough inodes. The mke2fs (mkfs.ext2) application uses the "bytes-per-inode" setting to calculate how many inodes a file system should have. On smaller partitions, it is advised to increase the calculated number of inodes.

Bei ext2 kann dies mit dem folgenden Befehl erfolgen:

root #mkfs.ext2 -T small /dev/<device>

Bei ext3 und ext4 fügen Sie die Option -j hinzu um Journaling zu aktivieren:

root #mkfs.ext2 -j -T small /dev/<device>

Dies vervierfacht die Zahl der Inodes für ein angegebenes Dateisystem in der Regel, da es dessen "bytes-per-inode" (Bytes pro Inode) von 16 kB auf 4 kB pro Inode reduziert. Durch die Angabe des Verhältnisses kann dies sogar weiter optimiert werden:

root #mkfs.ext2 -i <ratio> /dev/<device>

Dateisystem auf Partition anlegen

To create a filesystem on a partition or volume, there are user space utilities available for each possible filesystem. Click the filesystem's name in the table below for additional information on each filesystem:

Filesystem Creation command On minimal CD? Package
btrfs mkfs.btrfs Yes sys-fs/btrfs-progs
ext2 mkfs.ext2 Yes sys-fs/e2fsprogs
ext3 mkfs.ext3 Yes sys-fs/e2fsprogs
ext4 mkfs.ext4 Yes sys-fs/e2fsprogs
f2fs mkfs.f2fs Yes sys-fs/f2fs-tools
jfs mkfs.jfs Yes sys-fs/jfsutils
reiserfs mkfs.reiserfs Yes sys-fs/reiserfsprogs
xfs mkfs.xfs Yes sys-fs/xfsprogs
vfat mkfs.vfat Yes sys-fs/dosfstools
NTFS mkfs.ntfs Yes sys-fs/ntfs3g

For instance, to have the boot partition (/dev/sda2) in ext2 and the root partition (/dev/sda4) in ext4 as used in the example partition structure, the following commands would be used:

root #mkfs.ext2 /dev/sda2
root #mkfs.ext4 /dev/sda4

Erzeugen Sie nun die Dateisysteme auf den zuvor erzeugten Partitionen (oder logischen Laufwerken).

Activating the swap partition

mkswap is the command that is used to initialize swap partitions:

root #mkswap /dev/sda3

To activate the swap partition, use swapon:

root #swapon /dev/sda3

Erzeugen und aktivieren Sie jetzt die Swap-Partition mit den oben genannten Befehlen.


Now that the partitions are initialized and are housing a filesystem, it is time to mount those partitions. Use the mount command, but don't forget to create the necessary mount directories for every partition created. As an example we mount the root partition:

root #mount /dev/sda4 /mnt/gentoo
Wenn sich /tmp/ auf einer separaten Partition befinden muss, ändern Sie die Berechtigungen nach dem Einhängen folgendermaßen:
root #chmod 1777 /mnt/gentoo/tmp
Dies gilt ebenfalls für /var/tmp.

In der Anleitung wird später das Dateisystem proc (eine virtuelle Schnittstelle zum Kernel) zusammen mit anderen Kernel-Pseudodateisystemen eingehängt. Zunächst installieren wir jedoch die Gentoo Installationsdateien.