How to Delete Partition in Linux?

Linux is an open-source operating system favored by many users for its robustness, flexibility, and stability. One of the key features of Linux is its ability to provide users with better control over their system's resources through partitioning schemes, which divide a hard drive into multiple sections, allowing for more efficient use of space and resources.

What is a Partition in Linux?

A partition in Linux is a logical division or section on a hard drive that isolates data from other parts of the disk. It allows users to create separate spaces on their hard disk for different purposes like storing files, installing operating systems, and swap files. Partitions also protect data from being overwritten or corrupted by isolating it from other data.

The partitioning scheme in Linux operates at two levels primary and extended partitions. Primary partitions can contain operating systems and data, while extended partitions can be subdivided into logical partitions.

Importance of Deleting Partitions

There are several reasons why you might need to delete a partition in your Linux system

  • Storage reorganization Restructuring disk space for better utilization

  • Hardware issues Removing corrupt or damaged partitions

  • Security concerns Eliminating partitions infected with malware

  • Space optimization Freeing up valuable storage space for new uses

Preparing to Delete a Partition

Backing Up Important Data

Before deleting any partition in Linux, it is crucial to back up all important data stored on that partition. The deletion process permanently wipes out all contents, and failure to create backups will result in permanent data loss. Ensure you have copied all necessary files and folders to an external hard drive or cloud storage service.

Checking Disk Space and Usage

Check disk space and usage before deleting any partition to determine if the deletion will free up sufficient space or if additional steps are needed. Use the following command to view disk usage

df -h

This command outputs detailed information about disk usage for each mounted filesystem in human-readable format.

Identifying the Partition to Delete

Once you have backed up your data and assessed disk space, identify which partition to delete using the fdisk command

sudo fdisk -l

This displays a list of all partitions on your hard drive(s). Note the device name (e.g., /dev/sda1) of the partition you want to delete.

Method 1: Deleting Partition Using Command Line

Step 1: Open Terminal and Gain Root Access

Open the terminal by pressing Ctrl + Alt + T or searching for Terminal in the applications menu. You need root privileges to perform partition operations.

Step 2: Unmount the Partition

Before deleting a partition, it must be unmounted. Use the umount command

sudo umount /dev/sda1

If processes are using the partition, identify them with

lsof /dev/sda1

Step 3: Delete the Partition with fdisk

Use the fdisk command to delete the partition

sudo fdisk /dev/sda

Within the fdisk prompt

  • Type p to print the partition table

  • Type d to delete a partition

  • Select the partition number (e.g., 1 for /dev/sda1)

  • Type w to write changes and exit

Step 4: Verify Deletion

Confirm the partition has been deleted using

lsblk

The deleted partition should no longer appear in the output.

Method 2: Deleting Partition Using GUI

Step 1: Open Disk Utility

Navigate to Applications ? System Tools ? Disk Utility (or search for "Disks" in your application menu). Most Linux distributions include GParted or GNOME Disks as the default disk management tool.

Step 2: Select the Partition

In the Disk Utility window, select your hard drive from the left panel, then click on the specific partition you wish to delete from the graphical partition layout.

Step 3: Delete the Partition

Click the Delete button (usually represented by a minus sign or trash icon). A confirmation dialog will appear asking you to confirm the deletion. Double-check that you have selected the correct partition before confirming.

Step 4: Apply Changes

Click Apply or Apply All Operations to execute the deletion. The process may take a few moments depending on disk size and speed.

Comparison of Methods

Method Advantages Disadvantages Best For
Command Line Fast, precise control, works on all systems Requires terminal knowledge Advanced users, remote systems
GUI User-friendly, visual feedback May not be available on all systems Beginners, desktop environments

Important Considerations

  • Data Loss Partition deletion permanently erases all data. Always backup important files first.

  • System Partitions Never delete partitions containing your operating system or boot loader.

  • Active Partitions Unmount partitions before deletion to avoid system errors.

  • Partition Table Changes to partition tables require writing to disk and may need a system reboot to take full effect.

Conclusion

Deleting partitions in Linux can be accomplished safely using either command-line tools like fdisk or GUI applications like Disk Utility. The key to successful partition deletion is proper preparation backing up data, unmounting partitions, and carefully identifying the correct partition to delete. Both methods are effective, with CLI offering precision and GUI providing user-friendly visual management.

Updated on: 2026-03-17T09:01:38+05:30

13K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements