English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Linux fdisk command

Linux Command大全

Linux fdisk is a program for creating and maintaining partition tables, which is compatible with DOS-type partition tables, BSD, or SUN disk lists.

Syntax

fdisk [Required Parameters][Select Parameters]

Required Parameters:

  • -l List all partition tables
  • -u With"-l" combined, display the number of partitions

Select Parameters:

  • -s Specify Partition
  • -v Version Information

Menu Operation Instructions

  • m : Display Menu and Help Information
  • a : Active Partition Mark/Boot Partition
  • d : Delete Partition
  • l : Display Partition Type
  • n : Create New Partition
  • p : Display Partition Information
  • q : Exit Without Saving
  • t : Set Partition Number
  • v : Perform Partition Check
  • w : Save Changes
  • x : Extended Application, Advanced Features

Online Examples

Display the current partition status:

# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
  Device Boot   Start     End   Blocks  Id System
/dev/sda1  *      1     13   104391  83 Linux
/dev/sda2       14    1305  10377990  8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table

Display each partition of the SCSI hard disk

# fdisk -lu  
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
  Device Boot   Start     End   Blocks  Id System
/dev/sda1  *     63   208844   104391  83 Linux
/dev/sda2     208845  20964824  10377990  8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders, total 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk /dev/sdb doesn't contain a valid partition table

Linux Command大全