Linux Commands

Three Ways to Delete the Partitions Under Linux

This tutorial explains how to remove the partitions under Linux using different tools including fdisk, cfdisk and gparted.

After reading this article, you will be able to delete the partitions in Linux by applying a few steps. The command line techniques that are shared in the following examples are valid for all the Linux distributions. In some cases, some additional packages need to be installed. Additionally, we also included the steps for the users who are looking for a graphical method.

All the instructions in this document contain screenshots to make it easy for every Linux user to understand and implement them independently of their experience level.

Deleting Partitions Under Linux Using Cfdisk

The first section of this tutorial shows how to delete the partitions in Linux using the cfdisk partitioning tool.

The cfdisk utility is a command line that is interactive and a user friendly partitioner. This is the partitioning tool of choice for the users without too much experience with the Linux terminal. It is the easy version of the popular fdisk tool.

Before we start, let’s see our partition table, including all the storage attached devices. To do it, we can use the fdisk command followed by the -l (list) flag as shown in the following screenshot:

Note: The fdisk utility can be executed by the root and privileged users.

sudo fdisk -l

As you can see in the given output, there is a /dev/sdc device with two partitions: /dev/sdc1 and /dev/sdc2.

In our case, we want to delete the /dev/sdc2 partition (white arrow).

Run the cfdisk using sudo or as root, followed by the device whose partition is what you want to remove.

Note: Specify the /dev/sdX device, not the specific partition (/dev/sdX2).

sudo cfdisk /dev/sdc

As said previously, cfdisk is an interactive partitioning tool.

To start deleting a partition, use the Up/Down keys to select the partition to remove. And use the Left/Right keys to select the Delete option as shown in the following figure, and press ENTER.

Then, use the Left/Right keys to select Write and press ENTER.

After pressing ENTER, you will be requested to confirm the operation by typing “yes” (without quotation marks) and pressing ENTER.

Note: After this step, the partition will be fully deleted.

As you can see now, the old partition /dev/sd2 was deleted and its space is now unallocated.

To quit the cfdisk, just move to the Quit option and press ENTER.

That’s how you can easily remove the Linux partitions from the command line.

How to Remove Partitions Under Linux Using Fdisk

Despite not being very user friendly, the fdisk partitioning tool is the most popular among the Linux operating systems. It is even present in the Microsoft operating systems.

To show the connected storage devices and partitions, run the fdisk followed by the –l (list) flag as we did in the previous section of this tutorial.

As done in the first example of this tutorial, we delete the /dev/sdc2 partition.

Use sudo to run the fdisk followed by the device that contains the partition that you want to delete. In our case, it is the /dev/sdc.

Note: Specify the /dev/sdX device, not the specific partition (/dev/sdX2).

sudo fdisk /dev/sdc

After executing the sudo fdisk /dev/sdX (upper arrow), you will get a command prompt to execute the instructions.

The first instruction to indicate that you want to delete a partition is delete, which you can choose by typing the letter d, then pressing ENTER (second arrow).

Then, you will be asked to select the partition number to remove. In our case, we remove the /dev/sdc2 partition. Therefore, we type 2 and press ENTER (third arrow).

To apply the changes on the device and confirm the deletion of the partition, type w (Write) and press ENTER (lower arrow).

You can confirm whether the operation is successful by executing the sudo fdisk -l again.

sudo fdisk -l

As you can see, the partition was successfully removed.

How to Delete Partitions Under Linux Using Gparted (GUI)

This section shows a graphical alternative to remove the partitions under Linux called Gparted.

This is a good way for the users who are not used to the Linux terminal.

To begin, install the Gparted on the Debian based Linux distributions like Ubuntu using the apt command as instructed in the following image:

sudo apt install gparted -y

Once installed, execute the gparted from the console or from the Applications menu bar.

Type the sudo password when requested and press ENTER.

On the upper right corner, there is a dropdown menu to select the drive that contains the partition that you want to remove.

In our case, we selected the /dev/sdc device.

To remove the /dev/sdc2 partition, right-click it and press Delete.

You will notice that the partition now appears as unallocated, but changes were not yet made.

As you can see at the bottom of the window, the operation is still pending. To write the changes, press the green checkmark (upper arrow).

You will be asked to confirm the operation. After confirming it, your partition will be removed. This step cannot be undone.

After the partition is removed, press the Close button.

Now, you can close the Gparted.

That’s all. We hope that some of the given methods were good for you to delete your Linux partitions.


As you can see, removing the partitions in Linux is pretty simple. Linux offers different methods to achieve this, all of them can be implemented by any Linux user independently of their knowledge level. The command line techniques are applicable for all the Linux distributions, while Gparted is obviously only available for the operating systems with X Window managers or graphical environments.

It is important to remember that the instructions which are detailed in this article cannot be undone. If you remove a partition, the data won’t be easily recovered. By following the steps explained, you can remove all types of partitions including FAT, FAT32 and NTFS.

Thank you for reading this Linux tutorial which explains how to delete the partitions. Keep following us for additional Linux tips and articles.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.