The FDISK command for the Linux disk partition

Source: Internet
Author: User
Tags terminates

Fdisk is a high-risk operation and should not be easily tried and used.
Manage disk partition tables
-b Specifies the minimum sector size is 512 the other value must be a multiple of 512, the maximum is 4096
-c Specifies the compatibility mode parameter is Nondos, if you want to modify the parameters, then there is no space between the options and parameters-c=dos the system does not recommend modifying parameters
-c specifies that the cylinder system is not recommended for use
-H Get help information and exit
-l list partition information

-S Displays the specified partition information, showing the number of blocks for the specified partition

-U display partition table, partition size unit default to sector can be specified as cylinder
-V Show Fdisk program version

A detailed introduction to Fdisk-l

Device name/DEV/SDA This is a disk capacity of 128.8G total 128XXXXX bytes 251XXXX Sectors
Units Description Sector size
Sector size (logical sector/physical sector) 512/512 means 1:1.
I/o size (min/best) read data per IO
Disk label Diskette label DOS
Disk identifier The ID of the diskette
/dev/sda1/dev/sda2/dev/sda3 is a logical partition of a physical disk
The line with the * sign indicates that the partition is a boot partition
Start End represents the sector number at which the partition starts and terminates
Block: Shows how many blocks are in a partition
The Id represents the partition type partition type of the different types of partitions used to represent the partition purpose of the different common partition types are 1, 83 of this normal data storage partition, can be used to format EXT2/3/4 2, the 5-swap partition 3, the extension partition system is the annotation of the partition ID

To view the partitions of a specified disk

You can see that the disk size is 21.5g,boot without an asterisk indicating that the disk does not have a boot partition. The disk ID is different from the previous one and will be used for different purposes.

managing partitions with fdisk


through Fdisk/dev/sdb You can enter a program interface to manipulate disks by entering options
m to display features that Fdisk can support
N Used to create a new partition
P is used to display an existing partition


to create a partition with two choices p primary partition E for extended partition the extended partition is a special primary partition. The extended partition can only have 1, in order to make more flexible use of disk space, it is recommended that the non-bootable disk of the disk all first make up all the space to expand the partition, then the space partition.

The default is to create a primary partition, the partition number of the primary partition can only be 1 2 3 4 is the logical partition number starting from 5 is the
beginning of the sector area code is 2048 the partition terminates the partition number can be a sector area code can also be capacity size, if the contents of the error, cannot be deleted with BACKSPACE, You can delete the error input only with delete. There are special cases where space fragmentation occurs between two used partitions, such as 1 space fragments with a size of 2M and the remaining disk space of 10G, but during the operation it is found that 2G partitions cannot be created because the starting sector is in the fragmented space and the space of a partition must be contiguous. Therefore, you need to pay attention to the starting bit of the sector when creating partitions.

If the partition number of the primary partition is exhausted, and the disk space is still remaining, it cannot be used. The
now creates an extended partition, dividing the rest of the space in.

Each time the partition is created, the system tries to allocate the remaining space.

found something new, the option to create the partition again without E, only P and L (L). Only one extended partition can be created per disk.
in the case where all primary partitions are created, the administrator chooses to create the logical partition directly.

When 3 primary partitions are created, the system actively creates an extended partition by default. The

Primary partition number is exhausted, and if you want to create the partition again, the system will go directly to the program that created the logical partition.
D is used to delete an existing partition


Because there are only 1 partitions, the system automatically deletes existing partitions when the D option is selected.

T is used to modify the partition type


W is used to save the partition information table

This example is not the normal output.
Although a partition was created in the Fdisk program, there is no corresponding device in the device

Now there are SDB1/2/3 devices, but the real partition is only sdb1.

Partx-a/DEV/SDB This program is for the kernel to re-read the partition table, and this program may need to execute several times, if you still do not recognize the new partition can only restart the system. The device can be formatted only if it has a corresponding device.

The FDISK command for the Linux disk partition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.