Home >Computer Tutorials >Computer Knowledge >[Linux system] fdisk related partition commands.

[Linux system] fdisk related partition commands.

WBOY
WBOYforward
2024-02-19 18:00:18904browse

[Linux system] fdisk related partition commands.

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:

  1. Display disk partition information:

    fdisk -l

    This command will display the partition information of all disks in the system.

  2. Select the disk to operate:

    fdisk /dev/sdX

    Replace
    /dev/sdX with the actual disk device name to be operated, such as
    /dev/sda.

  3. 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.

  4. 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.

  5. 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.

  6. View partition information:

    p

    This will display the partition information of the currently selected disk.

  7. 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!

Statement:
This article is reproduced at:mryunwei.com. If there is any infringement, please contact admin@php.cn delete