“How do you remove a drive partition in Linux?” - Quora
You may want to delete some disk partitions on your Linux system from time to time to retrieve or gain back storage space. This guide will show you how to delete partitions in Linux steply. You can quickly achieve this in two ways:
Way 1: Delete Partitions in Linux Using fdisk Command-Line Tool
Way 2: Delete Partitions in Linux Using Gparted GUI Tool
Additionally, you also get a solution for recovering deleted partitions in Linux if you remove them accidentally.
How To Delete a Partition in Linux Using fdisk Command-line Tool
The fdisk utility, also known as format disk, is a Linux utility that comes standard with all modern Linux distributions. The tool allows you to create and delete disk partitions, modify the partition table, and print disk partitions.
Partitions are typically named according to the conventions below:
- For IDE drives: /dev/hdx
- For ISCI disks: /dev/sdx
Note: Before deleting a partition, back up your important data. When a partition is deleted, all data is automatically erased.
Prerequisites:
- A Linux-based system
- A user account with sudo or root access.
- Terminal window/command line access
- fdisk command-line utility
Delete a Standard Partition Using fdisk
Our configuration has a USB drive connected to the system with two partitions: /dev/sdc1 & /dev/sdc2. First, we will use the fdisk utility to confirm the existence of the partitions.
$ sudo fdisk -l /dev/sdc

Or you can also use the following command to list the partitions on the block volume.
$ lsblk | grep sdc

Using the fdisk utility, we will remove the second partition /dev/sdc2.
Step 1. To begin, launch the fdisk command-line tool.
$ sudo fdisk /dev/sdc
It opens a command-line prompt with interactive capabilities. Type p to print the drive's current partition table.

Step 2. Because our goal is to delete the second partition, type d and click ENTER, then specify the drive's partition number.
Partition number 2 corresponds to /dev/sdc2. You will be informed that Partition 2 has been deleted. To save the partition table changes, type w to write changes and tap ENTER.

Step 3. Rerun the fdisk utility to confirm that the volume has been deleted.
$ sudo fdisk /dev/sdc
To view the partition table, type p. Only one partition (/dev/sdc1) is listed this time. It verifies that you deleted the second partition successfully.

Delete an LVM Partition Using fdisk
LVM (Logical Volume Management) is a memory concept in which multiple disk partitions or hard drives are merged into a single Volume Group (VG). As a result, the volume group may be used as a single large volume or divided into other Logical Volumes (LV).
In this configuration, we have a volume group called vg01 mounted on a mount point called /data.
$ df -Th | grep -i /data

To view the Logical Volumes and Volume Groups, use the lvs command:
$ sudo lvs

We will remove lv01 Logical Volume from the vg01 Volume Group.
Step 1. Remove the Logical Volume entry from the /etc/fstab file.
$ cat /etc/fstab
/dev/mapper/vg01-lv01 /data ext4 defaults 0 0

Step 2. Save your changes and close the file.
Then, run the following commands simultaneously:
- $ sudo umount /data (unmount the directory that contains the Logical Volume)
- $ sudo lvchange -an /dev/vg01/lv01 (disable the Logical Volume Group)
- $ sudo lvremove /dev/vg01/lv01 (delete the LVM volume; to proceed, type y)
- $ sudo vgchange -an vg01 (disable the Volume Group)
- $ sudo vgremove vg01 (delete the Volume Group)
- $ sudo pvremove /dev/sdb1 /dev/sdb2 (remove the physical volumes that you used to create the vg01 Volume Group)

Step 3. If there is no output, running the lvs command again indicates that you successfully deleted the LVM volume.
$ sudo lvs

How To Delete a Partition in Linux Using Gparted GUI Tool
Gparted GUI Tool is an open-source and completely free graphical tool. It is practical for viewing, resizing, creating, and deleting partitions. Follow the steps below to delete a partition using Gparted GUI Tool in Linux.
Step 1. To start Gparted, type the following command into the Terminal:
$ gparted
Or you can also use the application manager to launch the GUI utility.

Step 2. To authenticate, enter your password and press ENTER.

Step 3. Once authenticated, Gparted will display the partitions on the main hard drive where Linux is installed.

Step 4. We'll use that hard drive because the partition to be deleted is on a removable drive that isn't listed.
To do so, navigate to Gparted > Devices > /dev/sdb.

Step 5. The partitions of the second hard drive are now listed.

Step 6. To delete the second partition (/dev/sdb2), we must first unmount it.
So, right-click and click Unmount.

Step 7. Right-click on the /dev/sdb2 partition and select Delete.

Step 8. You will immediately notice that the partition is labeled "Unallocated."
And you will see an alert in the bottom left corner of the Gparted window informing you of a pending operation.

Step 9. To apply the changes, click on the checkmark.

Step 10. Click Apply to continue the pending operations.

Step 11. The writing process is now completed, and the changes will be saved. Press Close.

How To Recover Deleted Partition in Linux if You Removed it Accidentally?
Don't stress if you unintentionally remove a partition in Linux. You still have a chance to get it back. When you unintentionally delete a partition in Linux, the data is not completely gone until new data overwrites it. A professional Linux data recovery tool like Recoverit Linux Recovery can help restore deleted partitions quickly and easily.

Recover over 1000 types of data types, like photos, videos, emails, files, audios, etc.
Recover data from numerous scenarios. Be it due to files being overwritten, a system crash, accidental formatting or virus attack, Recoverit is able to make a total recovery.
Support recovery of data from 2000+ storage devices, including computer/laptop, USB flash drive, SD memory card, external hard disk, digital camera, etc.
Ensure 100% data safe and easy operations.
The procedures listed below will help you use Recoverit Linux Recovery to recover any Linux partitions you unintentionally deleted quickly:
Step 1. Select Linux Recovery
Download and install Wondershare Recoverit on your Windows or Mac computer. Then, launch it and select the Linux Recovery option from the NAS and Linux section.

Step 2. Connect to Linux Computer
Enter your Linux device's IP, Port, User Account, and Password to establish a connection between the Linux and the data recovery software. Click Connect to proceed.

Step 3. Scan for Deleted Partition
The Linux Recovery tool will begin scanning any deleted or lost data in the Linux device once the connection is completed.

Step 4. Recover Deleted Partition
You will see the scanned files on the screen. Select and preview them to verify if they are the ones you need. If yes, click the Recover button to restore them to a safe location.

The Bottom Line
And it’s a wrap! You can seamlessly delete the partitions in the Linux disk using the fdisk command utility and the Gparted GUI tool. Before the deletion process, ensure a secure data backup. If you accidentally deleted the Linux partition, don’t worry, as Wondershare Recoverit will help you recover it.