Making Linux partitions is one of the toughest tasks for new Linux users. In this article, I will cover various topics on Linux partitioning. I’ll use different Linux partition managers to list, create, resize, extend and delete Linux partitions.
Gparted is the most popular and powerful partition manager for Linux. You can easily perform CRUD on your storage drives.
Listing partitions in Gparted is nothing more than opening the app itself. It takes a few seconds to load all the system drives and partitions.
cfdisk and an extremely easy to use tool for managing partitions. It is cli based but provides easy to use options to perform actions on your system drives.
Just open the app and it’ll list out all the partitions of the current storage drive.
To list partitions in fdisk, use the ‘l’ argument with fdisk.
Creating a partition using Gparted is extremely easy and quick in Linux. Simply select the drive you want to create partition from, right click and click ‘New’. Make sure to unmount the drive otherwise ‘New’ option will be greyed out.
Enter the new partition size and hit ‘Add’ button.
Click apply to start creating the partition.
To create a new partition using cfdisk, run cfdisk with sudo permission.
Select Free space you want to create a partition of. Select ‘New’ and hit enter.
Enter the partition size and hit enter. By default, it creates the partition of all free space. So just pause before you hit enter and see if you really want to create partition out of all free space.
Everything is setup. Now select ‘Write’ and hit enter. It will ask you to type ‘yes’ and hit enter. This is the last confirmation, after this prompt, cfdisk will create the partition.
That’s it. Partition created!
To create Linux partition using fdisk, first list partitions and note down the device path you want to create the partition from.
For this tutorial, I want to create a new partition from /dev/sda3. Then select the partition using fdisk command –
To create a new partition use ‘n’ command.
Select partition type. To create a primary partition, use ‘p’ command and ‘e’ for extended type.
Next, it will ask for partition number. Leave it default which is 1. Hit enter.
Then select the size of your new partition. The first sector, select default value, and Last sector enter the value in M. For example, to create a 2GB partition, type +2000M.At last, it’ll read the message as follows – ‘Created a new partition 1 of type ‘Linux’ and of size 2 GiB. ‘
But the partition is still not created. To write changes to disk, use ‘w’ command. It’ll show the following message – “The kernel still uses the old partitions. The new table will be used at the next reboot. Syncing disks.”
For the new partition to appear, you’ll need to reboot your system.
Resizing partition in Gparted is very simple. Open the app, select the partition you want to resize, right-click and select ‘Resize/Move’.
Enter the new partition size and hit ‘Resize/Move’ button. Lastly, click the apply button to apply the changes you have just made.
Start cfdisk with sudo permission.
Select the partition you want to resize. Select ‘Resize’ option and hit enter.
Enter the new partition size.
And finally, write changes to disk by selecting write option.
To delete a partition in Linux using GParted, simply select the partition, right-click and select delete option to delete the partition.
Do not forget to apply changes after deleting the partition.
To delete the partition using cfdisk, start cfdisk with sudo.
Highlight the partition you want to delete and select ‘Delete’ option.
And finally, write changes to disk by selecting ‘Write’ option.
To delete a partition using fdisk, first, run fdisk and select the partition to be deleted.
Then use ‘d’ command to delete the selected partition.
And after it’s deleted you can create a new partition by using ‘n’ command and finally write all the changes to the disk by passing ‘w’ command.
So that was all for now on how to manage Linux partitions. In this article, we taught you listing Linux partitions, creating Linux partitions, resizing partitions and deleting partitions using three main partition management tools in Linux.
I will keep updating articles with more commands and options. As I said above, if you have any question, drop it in the comment section below this article. I will try my best to cover that as well in this article.