Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| fdisk [Le 17/11/2013, 00:27] – [Installation] 62.235.185.202 | fdisk [Le 18/10/2020, 09:10] (Version actuelle) – [Modifier les partitions] 78.203.218.4 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | {{tag> système partitions BROUILLON}} | ||
| + | ====== FDISK ====== | ||
| + | [[wpfr> | ||
| + | |||
| + | ===== Pré-requis ===== | ||
| + | |||
| + | fdisk est un outil de bas niveau qui nécessite l' | ||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | fdisk est présent par défaut dans les distributions GNU/Linux. | ||
| + | < | ||
| + | [root@localhost /]# umount /dev/hda5 | ||
| + | |||
| + | [root@localhost /]# tune2fs -O ^has_journal /dev/hda5 | ||
| + | |||
| + | [root@localhost /]# fsck /dev/hda5 | ||
| + | |||
| + | [root@localhost /]# mount -t ext2 /dev/hda5 /usr/local | ||
| + | </ | ||
| + | ===== Utilisation ===== | ||
| + | |||
| + | fdisk permet de manipuler les tables de partitions. Il permet de créer, de supprimer, de lister les partitions sur un disque dur. | ||
| + | Voyons la syntaxe des différentes opérations : | ||
| + | |||
| + | ==== Lister les partitions ==== | ||
| + | |||
| + | < | ||
| + | sudo fdisk -l | ||
| + | </ | ||
| + | <note tips> | ||
| + | [[http:// | ||
| + | </ | ||
| + | nous donnera un résultat de ce type : | ||
| + | |||
| + | < | ||
| + | Disk /dev/sda: 159 GB, 159998146000 bytes | ||
| + | 255 heads, 63 sectors/ | ||
| + | Units = cylinders of 16065 * 512 = 8225280 bytes | ||
| + | |||
| + | | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ==== Modifier les partitions ==== | ||
| + | <note warning> | ||
| + | Les commandes suivantes doivent être utilisées avec précautions. Elles peuvent entrainer des pertes de données si elle ne sont pas correctement utilisées. | ||
| + | </ | ||
| + | |||
| + | <note tip>les options suivantes sont accessible après un : < | ||
| + | |||
| + | === Informations sur le disque selectionné === | ||
| + | On utilise la commande **p** | ||
| + | < | ||
| + | Commande (m pour l' | ||
| + | Units: sectors of 1 * 512 = 512 bytes | ||
| + | Sector size (logical/ | ||
| + | I/O size (minimum/ | ||
| + | Disklabel type: dos | ||
| + | Disk identifier: 0x3815f042 | ||
| + | |||
| + | Device | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | === Créer une partition === | ||
| + | On utilise la commande **n**. Fdisk demande ensuite le type de [[: | ||
| + | < | ||
| + | Command (m for help): n | ||
| + | Partition type | ||
| + | | ||
| + | | ||
| + | Select (default p): | ||
| + | |||
| + | Using default response p. | ||
| + | Partition number (1-4, default 1): | ||
| + | First sector (2048-1953525167, | ||
| + | Last sector, +sectors or +size{K, | ||
| + | |||
| + | Created a new partition 1 of type ' | ||
| + | </ | ||
| + | |||
| + | <note tips> | ||
| + | Ensuite, il est souvent nécessaire de formater la partition. (ATTENTION SUPPRIME TOUTES LES DONNEES SUR LA PARTITION !) | ||
| + | Par exemple pour obtenir une partition ext4 : | ||
| + | < | ||
| + | sudo mkfs -t ext4 /dev/sdXX | ||
| + | </ | ||
| + | En remplaçant XX par la lettre et le chiffre qui désigne la partition. | ||
| + | </ | ||
| + | |||
| + | === Supprimer une partition === | ||
| + | On utilise la commande **d**. Fdisk demande quelle partition il doit supprimer (sauf si une seule partition est présente). | ||
| + | < | ||
| + | Command (m for help): d | ||
| + | Partition number (1-4, default 4): | ||
| + | </ | ||
| + | |||
| + | === Modifier le type d'une partition === | ||
| + | Le type d'une partition facilite l' | ||
| + | |||
| + | L' | ||
| + | < | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | 10 OPUS 56 Golden Bow a7 NeXTSTEP | ||
| + | 11 Cachée FAT12 5c Priam Edisk | ||
| + | 12 Compaq diagnost 61 SpeedStor | ||
| + | 14 Cachée FAT16 < 63 GNU HURD or Sys ab Amorce Darwin | ||
| + | 16 Cachée FAT16 64 Novell Netware | ||
| + | 17 Cachée HPFS/ | ||
| + | 18 AST SmartSleep | ||
| + | 1b Cachée W95 FAT 75 PC/IX | ||
| + | 1c Cachée W95 FAT 80 Minix ancienne | ||
| + | 1e Cachée W95 FAT</ | ||
| + | L' | ||
| + | |||
| + | Exemple, on change le type d'une partition Linux (83) en Linux LVM (8e) | ||
| + | < | ||
| + | ... | ||
| + | Périphérique Amorce | ||
| + | / | ||
| + | |||
| + | Commande (m pour l' | ||
| + | Partition sélectionnée 1 | ||
| + | Code Hexa (taper L pour lister les codes): 8e | ||
| + | Type système de partition modifié de 1 à 8e (Linux LVM) | ||
| + | |||
| + | Commande (m pour l' | ||
| + | ... | ||
| + | Périphérique Amorce | ||
| + | / | ||
| + | |||
| + | Commande (m pour l' | ||
| + | La table de partitions a été altérée!</ | ||
| + | === Réparer l' | ||
| + | Il se peut qu'en faisant certaines manipulations sur les partitions, que l' | ||
| + | < | ||
| + | $ sudo fdisk /dev/sdb | ||
| + | [sudo] password for seb: | ||
| + | GNU Fdisk 1.0 | ||
| + | Copyright (C) 1998 - 2006 Free Software Foundation, Inc. | ||
| + | This program is free software, covered by the GNU General Public License. | ||
| + | |||
| + | This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
| + | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
| + | PARTICULAR PURPOSE. | ||
| + | |||
| + | Using /dev/sdb | ||
| + | Command (m for help): x | ||
| + | Expert command (m for help): m | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | f fix partition order | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | Expert command (m for help): f | ||
| + | </ | ||
| + | |||
| + | |||
| + | === Sauvegarder les changements === | ||
| + | Utiliser la commande **w** | ||
| + | < | ||
| + | Command (m for help): w | ||
| + | The partition table has been altered. | ||
| + | Calling ioctl() to re-read partition table. | ||
| + | Syncing disks. | ||
| + | </ | ||
| + | Pour informer le noyau du changement sur la table de partitions, faire un : | ||
| + | < | ||
| + | |||
| + | <note tips> | ||
| + | Pour ne pas sauvegarder les changements, | ||
| + | </ | ||
| + | |||
| + | ===== Voir aussi ===== | ||
| + | [[http:// | ||
