How to delete the Partition in RHEL

 Delete the partition:


In our previous tutorials, we have seen the concepts of  Linux disk management and creating the partitions, MBR, GPT partitions schemes, Now we are going to learn how to delete the partition permanently.

Whatever the task we do in Linux there are some procedures available for each and every task that we must have to follow in order to avoid the critical errors.

Procedures to delete the partition:


1.Check the hard disk  partition details

2.Check the filesystem is in active state  or in inactive state (i.e mounted state or unmounted state)

3.Unmount the mounted filesystem.

4.Verify whether it is unmounted properly

45Using the “fdisk “command to delete the partition

6.Save the changes and confirm it by using the fdisk command

Step:1 Check the  harddisk partition details


#fdisk  -l

From the above screenshot, the disk /dev/sdb is having two paritions, we will select the second partition(/dev/sdb2/) here to delete.

Step:2 Check the filesystem is in mounted state  or in unmounted state


#df  -h

The above screenshot says the partition /dev/sdb2 is in mounted state, so now we have to make this in to unmounted state(i.e inactive)

Step:3 Unmount the mounted filesystem


Syntax: To unmount a filesystem

#umount   <filesystem>

or

#umount  <mount point directory>

#umount   /dev/sdb2

or you can use the mount point directory to unmount (I have displayed both the ways to unmount, you can either use the mount point directory or use the filesystem name)

Step:4 Verify whether it is unmounted properly


#df  -h

From the above output, we have confirmed the /dev/sdb2 partition is in inactive state

Step:5  Using the fdisk command delete the partition


#fdisk   /dev/sdb

From the above screenshot, we have successfully deleted the partition /dev/sdb2

Step:6 Confirm it by using the “fdisk” command


#fdisk  -l

Now the partition /dev/sdb2 successfully remove from the hard disk

Note: If you forget to save the partition changes by pressing “w” then it won’t save the changes to the kernel memory when you run “fdisk -l you will see only the previous partition layout information.So always make sure you have saved the partition table changes to the kernel memory by pressing “w” before you exit from the fdisk program.

I hope now you have understood the Linux disk management concepts…if you have any queries feel free to leave a comment….. 

 

If you found this article useful, Kindly Subscribe 👉🏿👉🏿Click this link to Subscribe 

 

 

About Author:

Hello readers! Let me introduce my self first. My name is Vasanth Nirmal Singh J S having 9+ years of experience in IT on all flavours of Unix operating systems ,Storage's and many more .. I would like to share my technical experience i have come across - can be help to other people. So in this blog, I'll post my thoughts related to ITIS. I'll share experiences that I've had while working in different environments. You can expect content related to Unix,Solaris,Linux,EMC Storeages,HP-UX and many others. I hope this blog can be useful for you! Your comments will be appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *