How to create primary and logical partitions in Linux?

You can follow these steps to create primary and logical partitions:

  1. Open the terminal or command line interface and log in with administrator privileges.
  2. Access the partition tool using the fdisk command. For example, type in the following command:
sudo fdisk /dev/sda

Please note that /dev/sda is the name of the device you want to partition. Depending on your needs, it may be a different name, such as /dev/sdb, etc.

  1. In the fdisk interface, you can utilize the following commands:
  1. Create a new partition.
  2. Modify a primary partition.
  3. e: Set up an extended partition.
  4. Create a logical partition.
  5. d: Remove a partition.
  6. w: Save and exit.
  1. According to your needs, choose the corresponding option as prompted. For example, if you want to create a primary partition, you can press the ‘p’ key and then follow the prompts to input the starting and ending sectors of the partition.
  2. After creating and setting up all partitions, press the “w” key to save and exit fdisk.

Before creating logical partitions, you must first create an extended partition. An extended partition can contain multiple logical partitions.

After creating primary and logical partitions, you can format the partitions using the mkfs command and mount them to the file system using the mount command.

Please note that partitioning may affect your data, so be sure to back up important data before partitioning.

广告
Closing in 10 seconds
bannerAds