How to create a new logical partition in linux?

To create a new logical partition within an extended partition in Linux, you can use the fdisk or parted command-line utilities. Here are the steps using both tools:

Note: Be very careful when working with partitioning tools, as improper use can lead to data loss. Make sure to back up any important data before proceeding.

Using fdisk tool:

1. Open a terminal window of the system which you want to create a new logical partition.

2. Run the following command to list your existing partitions:

sudo fdisk -l

Identify the extended partition in which you want to create a logical partition. Extended partitions are usually marked as “Extended” as shown in the below figure.

Note : In some systems, the disk label type might be gpt, in that case, Extended might not be there as we can create huge number of logical partitions using the GPT formatted disks unlike dos formatted disks.

If there is no extended partition available, you can create the same.

3. Run the fdisk command on the disk containing the extended partition. Replace /dev/sdX with the appropriate device identifier (e.g., /dev/sda`).

sudo fdisk /dev/sdX

4. Inside the fdisk utility, press n to create a new partition.

5. Choose the logical partition type by pressing l, or just press Enter to accept the default (usually 83 for Linux).

6. Specify the starting and ending sectors for the new logical partition or you can give the values in terms of K – Kilobytes, M – Megabytes, G – Gigabytes. You can use the default values to use the entire available space or specify your own values. Be mindful of the space available within the extended partition.

7. You can list the created partition using p option while within the fdisk utility. From the below figure, you can see that the /dev/sda5 logical partition has been created.

8. Once you’ve set the partition size, press w to write the changes to disk and exit fdisk.

9. After exiting from fdisk, you can see the created partitions using lsblk command as shown in the below figure.

10. You may need to reboot your system for the changes to take effect if required.

Using parted tool:

1. Open a terminal window of the system which you want to create a new logical partition.

2. Run the following command to list your existing partitions:

sudo parted /dev/sdX print

Identify the extended partition in which you want to create a logical partition. Extended partitions are usually marked as “Extended.”

3. Run the parted command on the disk containing the extended partition. Replace /dev/sdX with the appropriate device identifier (e.g., /dev/sda).

sudo parted /dev/sdX

4. Inside the parted utility, use the following commands to create a logical partition:

(parted) mkpart logical ext4 0% 10%

This command creates a logical partition with the file system type “ext4,” starting at 0% and ending at 10% of the available space within the extended partition. You can adjust the file system type and size according to your needs.

5. After creating the logical partition, type quit to exit parted.

6. After exiting parted, use lsblk command to verify created logical partition or you may need to reboot your system for the changes to take effect.

Once you’ve completed these steps, your new logical partition should be created within the extended partition on your Linux system. You can then format it, mount it, and use it as needed.

Want to know how to create a primary partition in linux, Click Here!!

How do you feel about this post, drop your comments below!!!