As you use your computer, there's always a chance that your storage drive receives a nasty virus or gets corrupted. In that event, the only action to make it usable again is to delete the concerning partitions and start over. While Windows and macOS offer several options, removing the Linux partition may prove challenging. It is a CUI-based operating system, which makes it harder to grasp for a generation used to graphic interfaces.
Throughout this piece, you’ll learn how to delete a partition in Linux, one with third-party GUI software and the other using the fdisk command-line utility.
Ease of Use
|GUI||Method 1. Using GParted Partition-Editing Tool||Easy||Any user can install the software and use it|
|Command-Line||Method 2. Using fdisk Command||Hard||Recommended for Linux experts and system administrators|
Method 1: Delete Partition in Linux With GParted [GUI Interface]
GParted (GNOME Partition Editor) is a disk and data management software that can help you easily remove the Linux partition of your choice. You may prefer this method if you are unsure of your IT skills. It is recommended for those fearing that they'll enter the wrong commands and would have to invest even more time trying to get the system back on track.
GParted is an open-source software first released in 2004. Over the years, it has received several updates from its original developers and communities. As a result, it provides a robust GUI that lets users easily create, delete, copy, and move partitions without losing data. You can use it for various file systems like Ext3, Ext4, FAT32, HFS+, and NTFS.
You can download and install GParted for your Linux distribution package from the official website.
Since the program processes the text-based commands into clickable buttons, checking which Linux package you run on your system is best. You can determine it using the following command.
$ lsb_release -a
Once you download the appropriate installer package, you can install it using the respective command in the column provided next to it. As Ubuntu is the most popular distribution, we’ll focus on deleting partitions in Ubuntu using GParted. To do that, follow the steps mentioned below.
Step 1: Go to the Applications menu of Ubuntu and type ‘GParted’ in the search bar.
Step 2: Choose the GParted icon from the search results.
Step 3: GParted requires root access to your system. So, you must log in with your system password and click on Authenticate if you’re using GParted for the first time.
Step 4: The software should now display all the storage drives connected to your system. If your desired drive is not on the list, it helps to check the cable connection and relaunch the program.
Step 5: Right-click on the one you wish to delete and select the Delete option from the drop-down menu. You can also use the Delete button in the Partition tab from the top pane. All the storage space within the partition should now show as unallocated.
Step 6: Select the green tick symbol from the top pane to make your changes permanent. You will need to confirm your decision from an additional dialog box.
Step 7: Once you click on Apply, GParted will start deleting the partition. It will take some time to complete, depending on its size.
Step 8: When the process concludes, click on Close to terminate the dialog box.
When the partition is deleted, it is best to check that it no longer appears on the program's main page. An excellent benefit of GParted is that you can still use other partitions on the system as per your preference, even as another partition is being deleted.
When to Use GParted
GParted is the perfect solution for you if you fulfill the following criteria.
- You need to delete the partition efficiently but are okay with waiting a few extra minutes.
- You don’t mind dedicating some of the hardware resources to make the function more intuitive.
- You are not familiar with the command-based UI that you find on most Linux kernels.
- You don’t have a data backup to restore the partition should things go wrong.
- You don’t wish to pay a premium just to delete a corrupt partition on your system.
Method 2: Delete Partition in Linux With fdisk Utility [Command-Line Tool]
While you can easily install a graphics-based software of your choice, Linux deletes all partitions on disk using the
fdisk utility. It is a command you can utilize to access the various disk partitions, both primary and extended, even removing the Linux partition you don't need.
Unfortunately, no 'delete partitions in Linux' command can be used with any of the attached disks. Instead, you must follow a series of procedures to check for available divisions. Remember that Ubuntu's delete partition CMD is separate from Fedora's. So, you have to check your version of Linux before going through with this method. That’s why its regular use is limited to system administrators and IT experts.
To delete partitions in Linux using fdisk, follow the steps mentioned below.
Step 1: Run this command to list all the partitions on your system:
Note: You cannot delete the partitions that contain the boot sector drive for your Linux distribution.
Step 2: Next, select the partition that you want to delete through this command:
sudo fdisk /dev/sdb (Replace
sdb with the relevant partition on your system)
Step 3: To delete the partition, type the
d command in the fdisk utility. It automatically selects the primary partition if there are no other partitions on the disk. Select a partition if the disk contains multiple partitions by typing its number. Post that, the terminal prints a message confirming that the partition has been deleted.
Step 4: Once the partition is deleted, type in
p and press Enter. It will verify that the deleted partition no longer exists on the disk.
Step 5: Exit the fdisk utility by typing the
If you want a more comprehensive breakdown of the command-line-based method, you can check out this Youtube video that describes each step in detail.
When to Use fdisk
While more complicated than graphics interface software, the command line method can suit several situations.
- It is the fastest method to delete partitions in Linux.
- It doesn’t put a lot of stress on your system’s hardware.
- You should go for this method if you’re comfortable using Linux commands and have successfully executed other disk-related functions in the past.
- You have a backup for your data should things not go according to plan.
- You don’t need to use your computer as a partition is being deleted.
- You don’t want any additional software taking up space on your hard drive.
You may also like:
How to List/Show Partitions in Linux?
How To Recover Deleted Files in Linux
And that concludes our guide for removing partitions on Linux using both GUI-based software and the fdisk utility. What’s your preferred method for deleting partitions in Linux? Do you think the latest updates make fdisk easier to use? Feel free to share your thoughts with us.
For Windows XP/Vista/7/8/10/11
For macOS X 10.10 - macOS 13