Before removing the partition, make sure to unmount any partitions on the device and turn off any swap space on the device. Do not remove a partition on a device that is in use. Also take backup of the mount point using that partition, if the data is important to you.
1. Execute parted command to start
2. Suppose, /dev/sda is the device on which to remove the partition. Use the parted commnad with the /dev/sda device as shown below:
# parted /dev/sda
3. View partition table to determine the minor number of the partition to remove:
4. Remove the partition with the command rm. For example, to remove the partition with minor number 2:
# rm 2
5. After the partition has been removed, use print command to confirm that it is removed from the partition table. You cam view the output of /proc/partitions to make sure the kernel knows the partition has been removed.
# cat /proc/partitions
6. Remove entry from the /etc/fstab file. Find the line that declares the removed partition, and remove it from the file.
# vi /etc/fstab