How to Remove a Disk Partition From CentOS 7 Linux

by | Feb 20, 2023 | Uncategorized

A portion of a data storage device is referred to as a hard drive partition. There are various formats available for disc partitions. Windows’ NTFS file system to ext4 (on Linux). Disk partitions have two numbers, one at the beginning and one at the end. On your hard drive, these are addresses. The address begins at one byte on the disc and finishes at another. Thus, a partition aids in the organisation of data on a disc. While occasionally we need to erase a disc segment in order to manage the data. This article will demonstrate how to remove a disc partition in CentOS 7 Linux.

Linux Partition Layout by Default

Your / root Partition is the primary partition for the majority of Linux systems. All other partitions, whether they are primary or logical, mount to that partition in the meantime. Linux further divides these disc partitions into the following categories.

  • data partition: data typical to the Linux system, such as the root partition, which contains all the data required to start and execute the system; and
  • swap partition: an increase in the physical memory of the computer, or additional hard-drive memory.

Examining the disc partitions on Linux CentOS 7

To avoid making a mistake, let’s grasp the partition style before removing the partition. To check the disc partition style in CentOS 7, enter the command.

# fdisk -l

In this instance, the terminal displays out details on three discs with the names “sda1,” “sda2,” and “sdb1.” The user data, swap, and root partitions are located on disc “sda2,” whereas the OS’s essential boot information is located on disc “sda1.” The “lsblk” command, which is used to display information on block devices, can be used to verify that.

How to Remove a Disk Partition in CentOS 7

In this instance, we’re going to remove the “sdb1” partition from “/dev/sdb.” With the provided command, select the device for which you want to erase the partition.

# fdisk /dev/sdb

Data backup is a must before partition deletion. All data on a partition will be automatically deleted, making data recovery impossible.

To remove the partition on disc “sdb,” type d. The partition will be automatically chosen and erased if the disc has no other partitions. Enter the number to choose the partition if the hard drive has several partitions.

By entering the command p (partition view), you may confirm that the proper piece was erased. As you can see, there are no additional partitions on the drive “sdb” and the partition has been erased.

To save any modifications made to the disc “sdb,” execute the w command.


These are the fundamental procedures for deleting a disc partition in CentOS 7 Linux. I suggest reading the lesson on creating partitions in Linux if you want to learn more about working with partitions. I suggest reading Mounting NTFS partitions in Linux if you’re using an NTFS partition. which the upcoming sessions will cover.

Read Our Next Articles In A Linux Centos 7,Create A Disc Partition