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
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
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 <mount point directory>
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
From the above output, we have confirmed the /dev/sdb2 partition is in inactive state
Step:5 Using the fdisk command delete the partition
From the above screenshot, we have successfully deleted the partition /dev/sdb2
Step:6 Confirm it by using the “fdisk” command
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