Latest web development tutorials

Linux fdisk command

Linux command Daquan Linux command Daquan

Linux fdisk program is to create and maintain a partition table, which is compatible with the type of disk partition table listing DOS, BSD or SUN type.

grammar

fdisk [必要参数][选择参数]

Necessary parameters:

  • -l List all prime partition table
  • -u with the "-l" with the use, display the number of partitions

Selection parameters:

  • -s <partition number> Specify the partition
  • -v version information

Menu instructions

  • m: menus and help information
  • a: active partition labeled / boot partition
  • d: delete partition
  • l: display the partition type
  • n: New Partition
  • p: Display partition information
  • q: Quit without saving
  • t: set the partition number
  • v: Check partition
  • w: Save changes
  • x: expanded applications, advanced features

Examples

Displays the current regional situation:

# 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

Each partition display case of SCSI hard drive

# 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 Daquan Linux command Daquan