fdisk
is a commonly used Linux command line tool used to create, manage and modify disk partitions. The following are some commonly used fdisk
commands:
Display disk partition information:
fdisk -l
This command will display the partition information of all disks in the system.
Select the disk to operate:
fdisk /dev/sdX
Replace /dev/sdX
with the actual disk device name to be operated, such as /dev/sda
.
Create new partition:
n
This will guide you to create a new partition. Follow the prompts to enter the partition type, starting sector, size and other information.
Delete partition:
d
This will guide you to select the partition you want to delete. Follow the prompts to select the partition number to be deleted.
Modify partition type:
t
This will guide you to select the partition you want to modify the type of. Follow the prompts to select a partition number and new partition type.
View partition information:
p
This will display the partition information of the currently selected disk.
Save and exit:
w
This will save changes to the disk partition and exit fdisk
.
Please note that fdisk
is a powerful tool, but please make sure you operate the disk partition very carefully before using it to avoid losing data. In addition, the above commands only provide some common fdisk
usage examples. You can view more detailed usage and options through the man fdisk
command.
The above is the detailed content of [Linux system] fdisk related partition commands.. For more information, please follow other related articles on the PHP Chinese website!