Linux users create partitions to organize their data in an efficient manner. As easy as they are created, Linux partitions can be deleted to reformat a storage device and regain storage space.
In this step-by-step tutorial, you will learn how to delete a partition on a Linux system.
- A system running Linux
- A user account with
- Access to a terminal window / command line (Activities > Search > Terminal)
Delete a Partition in Linux
Deleting a partition in Linux requires selecting the disk containing the partition and using the
fdisk command-line utility to delete it.
Follow the steps outlined in the sections below to delete partitions in Linux.
fdisk command-line utility is a text-based partition table manipulator. It is used for partitioning and repartitioning storage devices.
Step 1: List Partition Scheme
Before deleting a partition, run the following command to list the partition scheme.
In our case, the terminal prints out information about two disks:
/dev/sda contains the operating system, therefore its partitions should not be deleted.
/dev/sdb disk, there is a
/dev/sdb1 partition which we are about to delete.
Note: The number 1 in
/dev/sdb1 indicates the partition number. Make a note of the number of the partition you intend to delete.
Step 2: Select the Disk
Select the disk that contains the partition you intend to delete.
Common disk names on Linux include:
|Type of disk||Disk names||Commonly used disk names|
To select a disk, run the following command:
sudo fdisk /dev/sdb
Step 3: Delete Partitions
Before deleting a partition, back up your data. All data is automatically deleted when a partition is deleted.
To delete partition, run the
d command in the
fdisk command-line utility.
The partition is automatically selected if there are no other partitions on the disk. If the disk contains multiple partitions, select a partition by typing its number.
The terminal prints out a message confirming that the partition is deleted.
Note: If you wish to delete multiple partitions, repeat this step as many times as necessary.
Step 4: Verify Partition Deletion
Reload the partition table to verify that the partition has been deleted. To do so, run the
The terminal prints out the partition structure of the disk selected in Step 2.
Step 5: Save Changes and Quit
Run the w command to write and save changes made to the disk.
After following the instructions in this tutorial, you should have learned how to delete a partition in Linux.
If you want to learn more about partition manipulation, we recommend reading our tutorial on creating partitions in Linux or if you are running NTFS partitions, check out our article on how to mount NTFS partitions in Linux.