• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Delete Disk Partition using Parted Command

by admin

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

# parted

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:

# print

4. Remove the partition with the command rm. For example, to remove the partition with minor number 2:

# rm 2
Note: The changes start taking place as soon as Enter has been pressed, please review the command before executing and committing to it.

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

Filed Under: Linux

Some more articles you might also be interested in …

  1. Beginners Guide to DHCP – Install and configure DHCP server and client
  2. How to Disable NUMA in CentOS / RHEL 6,7
  3. Complete Guide to Configuring iSCSI in CentOS / RHEL 7
  4. Linux OS Service ‘ldap’
  5. How to configure iSCSI Initiator (client) in CentOS / RHEL 6
  6. UNIX / Linux : How to delete root equivalent user (Non-Root User with UID 0)
  7. Common Init.ora Parameters and Unix, Linux Kernel Parameters and Relationship Between Them
  8. CentOS / RHEL 7 : Beginners guide to systemd
  9. “You must wait longer to change your password” – error while changing password in CentOS/RHEL
  10. LVM Configuration : Physical Volume (PV) Operations/Utilities

You May Also Like

Primary Sidebar

Recent Posts

  • What are /dev/zero and /dev/null files in Linux
  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright