• 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. Understanding /etc/login.defs file
  2. bpftool Command Examples in Linux
  3. Basic vi commands (cheat sheet)
  4. CentOS / RHEL 6 : How to limit memory resources for a specific user using cgroups
  5. How to configure postifx smtp relay in CentOS/RHEL 5 and 6
  6. SSH Connection Refused by TCP Wrapper
  7. How to Install apt-utils with apt-get?
  8. Managing MySQL Using Systemd As A Non Root User
  9. gs Command Examples in Linux
  10. How to Check vendor of installed RPM packages in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright