delpart - Linux


delpart is a versatile Linux command designed to delete partitions from a specified hard disk drive. It offers a convenient and efficient way to manage disk space and prepare drives for new partitions or operating systems.


delpart [options] <device> <partition>


  • -f, –force: Override any existing partitions or data on the specified device.
  • -s, –size: Specify the size of the partition to delete.
  • -h, –help: Display help information.


Simple Deletion:

delpart /dev/sda1

Delete with Specific Size (250GB):

delpart -s 250G /dev/sda2

Force Deletion (Overriding Existing Data):

delpart -f /dev/sdb3

Common Issues

Partition Not Found:

  • Ensure the specified partition number is correct.
  • Verify the device name is valid (e.g., /dev/sda1).

Permission Denied:

  • Run the command as root or with sudo privileges.

Device Not Found:

  • Check if the disk is properly connected or detected by the system.
  • Ensure the device name is spelled correctly.


Combining with fdisk:

fdisk /dev/sda
d 2             # Delete partition 2
p              # Print updated partition table

Using with dd:

dd if=/dev/zero of=/dev/sda2 bs=4k count=10000   # Overwrite partition 2 with zeros
delpart /dev/sda2                                # Delete partition 2

Related Commands

  • fdisk: Manage disk partitions interactively.
  • parted: Create, manipulate, and delete partitions.
  • cfdisk: Ncurses-based disk partitioning tool.