Handbook:AMD64/Blocks/Disks/fr

Tables de partition
Bien qu’il soit théoriquement possible d’utiliser un disque brut et non partitionné pour héberger un système Linux (lors de la création d’un RAID btrfs par exemple), cela n’est réellement jamais fait. Les périphériques de bloc de disque sont scindés en blocs plus petits, plus faciles à gérer. Pour l’architecture, on appelle ces blocs des partitions. Deux technologies de partitionnement standard sont actuellement disponibles : MBR et GPT.

MBR
La configuration MBR (Master Boot Record) utilise des identifiants 32 bits pour le secteur de démarrage et la longueur des partitions et prend en charge trois types de partitions : primaire, étendue et logique. Les partitions primaires stockent leurs informations directement dans le MBR - un très petit emplacement (généralement 512 octets) au tout début d’un disque. En raison de cet espace restreint, seules quatre partitions primaires sont prises en charge (par exemple, à ).

Pour prendre en charge davantage de partitions, l’une des partitions primaire peut être marquée en tant que partition étendue. Cette partition peut alors contenir des partitions logiques (des partitions dans une partition).

Les auteurs de ce manuel suggèrent d'utiliser GPT autant que possible pour les installations de Gentoo.

GPT
La configuration GPT (GUID Partition Table) utilise des identifiants 64 bits pour les partitions. L'emplacement dans lequel elle stocke les informations de partition est beaucoup plus grand que les 512 octets d'un MBR, ce qui signifie qu'il n'y a pratiquement aucune limite sur le nombre de partitions d'un disque GPT. De plus, la taille d'une partition est limitée par une limite beaucoup plus grande (presque 8 Zo - oui, zettaoctets).

Lorsque l'interface logicielle entre le système d'exploitation et le micrologiciel est UEFI (au lieu du BIOS), GPT est presque obligatoire car des problèmes de compatibilité surviennent avec MBR.

GPT profite également de l'utilisation de la somme de contrôle et de la redondance. Il utilise les sommes de contrôle CRC32 pour détecter les erreurs dans les tables d'en-tête et de partition et dispose d'une sauvegarde GPT en fin de disque. Cette table de sauvegarde peut être utilisée pour réparer les dommages subis par le GPT principal situé au début du disque.

GPT or MBR
D'après les descriptions ci-dessus, on pourrait penser que l'utilisation de la technologie GPT devrait toujours être l'approche recommandée, cependant, il y à quelques exceptions.

L'utilisation de GPT sur un ordinateur basé sur le BIOS fonctionne, mais il est alors impossible de procéder à un double démarrage avec un système d'exploitation Microsoft Windows. La raison est que Microsoft Windows démarrera en mode UEFI s’il détecte une étiquette de partition GPT.

Certains microprogrammes de carte mère bogués configurés pour démarrer en mode BIOS/CSM/legacy peuvent également rencontrer des problèmes lors du démarrage à partir de disques étiquetés GPT. Si tel est le cas, il est possible de contourner le problème en ajoutant l'indicateur boot/active sur la partition de protection MBR, ce qui doit être effectué via à l'aide de l'option   pour le forcer à lire la table de partition en utilisant le format MBR.

Dans ce cas, lancez et activez/désactivez l'option à l'aide de la touche. Appuyez sur pour sélectionner la première partition, puis appuyez sur la touche pour écrire les modifications sur le disque et quitter l'application  :

Utiliser 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 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:

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.

LVM
The 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.

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

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 and  are partitioning utilities. is well known, stable, and recommended for the MBR partition layout while was one of the first Linux block device management utilities to support GPT partitions. Those who like the user interface of can use  (GPT fdisk) as an alternative to.

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.

What is the BIOS boot partition?
A BIOS boot partition is a very small (1 to 2 MB) partition in which boot loaders like GRUB2 can put additional data that doesn't fit in the allocated storage (a few hundred bytes in case of MBR) and cannot be placed elsewhere.

Such partitions are not always necessary, but considering the low space consumption and the difficulties we have with documenting the plethora of partitioning differences otherwise, it is recommended to create it in either case.

For completeness, the BIOS boot partition is needed when a GPT partition layout is used with GRUB2 in PC/BIOS mode. It is not required when booting in EFI/UEFI mode.

Default: Using parted to partition the disk
In this chapter, the example partition layout mentioned earlier in the instructions will be used:

Change the partition layout according to personal preference.

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

Alignment means that partitions are started on well-known boundaries within the disk, ensuring that operations on the disk from the operating system level (retrieve pages from the disk) use the least amount of internal disk operations. Misaligned partitions might require the disk to fetch two pages instead of one even if the operating system asked for a single page.

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

Setting the GPT label
Most disks on the or  architectures are prepared using an msdos label. Using, the command to put a GPT label on the disk is :

To have the disk with MBR layout, use.

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

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 which stages them, allowing a user to "undo" his changes before saving or exiting fdisk).

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


 * The partition type to use. This usually is primary. If the msdos partition label is used, keep in mind that there can be no more than 4 primary partitions. If more than 4 partitions are needed, make one of the first four partitions extended and create logical partitions inside it.
 * The start location of a partition (which can be expressed in MB, GB, ...)
 * The end location of the partition (which can be expressed in MB, GB, ...)

First, tell parted that the size unit we work with is megabytes (actually mebibytes, abbreviated as MiB which is the "standard" notation, but we will use MB in the text throughout as it is much more common):

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

Do the same for the boot partition (128 MB), swap partition (in the example, 512 MB) and the root partition that spans the remaining disk (for which the end location is marked as -1, meaning the end of the disk minus one MB, which is the farthest a partition can go).

When using the UEFI interface to boot the system (instead of BIOS), mark the boot partition as the EFI System Partition. Parted does this automatically when the boot option is set on the partition:

The end result looks like so:

Use the command to exit parted.

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

Change the partition layout according to personal preference.

Viewing the current partition layout
is a popular and powerful tool to split a disk into partitions. Fire up against the disk (in our example, we use ):

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

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").

Removing all partitions with fdisk
First remove all existing partitions from the disk. Type to delete a partition. For instance, to delete an existing :

The partition has now been scheduled for deletion. It will no longer show up when printing the list of partitions (, 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 immediately and hit  and the partition will not be deleted.

Repeatedly type to print out a partition listing and then type  and the number of the partition to delete it. Eventually, the partition table will be empty:

Now that the in-memory partition table is empty, we're ready to create the partitions.

Creating the BIOS boot partition
First create a very small BIOS boot partition. Type to create a new partition, then  to select a primary partition, followed by  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. When prompted for the last sector, type +2M to create a partition 2 Mbyte in size:

Mark the partition for UEFI purposes:

Creating the boot partition
Now create a small boot partition. Type to create a new partition, then  to select a primary partition, followed by  to select the second primary partition. When prompted for the first sector, accept the default by hitting. When prompted for the last sector, type +128M to create a partition 128 Mbyte in size:

Now, when pressing, the following partition printout is displayed:

Type to toggle the bootable flag on a partition and select. After pressing again, notice that an * is placed in the "Boot" column.

Creating the swap partition
To create the swap partition, type to create a new partition, then  to tell fdisk to create a primary partition. Then type to create the third primary partition,. When prompted for the first sector, hit. When prompted for the last sector, type +512M (or any other size needed for the swap space) to create a partition 512MB in size.

After all this is done, type to set the partition type,  to select the partition just created and then type in 82 to set the partition type to "Linux Swap".

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

Saving the partition layout
To save the partition layout and exit, type.

With the partitions created, it is now time to put filesystems on them.