Formater un support de stockage

Installer la boite à outils

$ sudo apt-get install dosfstools

Lister les supports de stockage

$ sudo fdisk -l

Formater en FAT 12 OU 16

$ mkfs.vfat /dev/sdb1

Formater en FAT 32

$ mkfs.vfat -F 32 -n nom_de_ma_cle_usb /dev/sdb1

Pour formater un support de stockage, celui-ci ne doit pas être monté.

$ umount /media/ma_cle_usb

Pour les autres formats :

  1. mkfs.bfs     
  2. mkfs.ext2    
  3. mkfs.ext4    
  4. mkfs.minix   
  5. mkfs.ntfs
  6. mkfs.cramfs  
  7. mkfs.ext3    
  8. mkfs.ext4dev
  9. mkfs.msdos   
  10. mkfs.vfat

Formater en NTFS

$ apt-get install ntfs-3g ntfsprogs

$ mkntfs /dev/sde1

Afficher le format/type exact d'une partition

La commande fdisk -l ne permet pas de connaitre le type exact d'une partition.

$ fdisk -l
 
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          66      524288   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              66      121601   976235712   8e  Linux LVM
 
Disk /dev/sdb: 1500.3 GB, 1500299395072 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00026d5d
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      182401  1465136001   83  Linux
 
Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008ef40
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       19457   156288321   83  Linux
 
Disk /dev/sdd: 2000.4 GB, 2000396746752 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00101aa1
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1      243201  1953512001   83  Linux
 
Disk /dev/sde: 80.0 GB, 80032038912 bytes
255 heads, 63 sectors/track, 9730 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f2c13
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1        9730    78156193+   b  W95 FAT32

La commande blkid est beaucoup plus précise

$ blkid
/dev/sda1: UUID="cd34d37b-b73c-4ee4-820c-c8006043518a" SEC_TYPE="ext2" TYPE="ext3"
/dev/sda2: UUID="BVYNlC-AQG0-oDe9-I4zu-xVzp-RdV3-W1Fegr" TYPE="LVM2_member"
/dev/sdb1: UUID="a6ea6463-e289-4bbe-afba-572f876497da" TYPE="ext4"
/dev/sdc1: UUID="1a6c5464-6ae1-4205-97c5-edae82649198" SEC_TYPE="ext2" TYPE="ext3"
/dev/sdd1: UUID="8ea1a0ee-c21c-4892-bdc9-bda6186ebd98" TYPE="ext4"
/dev/sde1: UUID="4961B8D578F1B234" TYPE="ntfs"