How to delete a disk partition in Linux

Purpose

  • Delete a partition that is no longer needed or recreate it from scratch
  • Example: The partition has not been formatted, mounted, or used to store data

We will remove this partition.

Steps

  • Open the disk
    fdisk /dev/nvme0n1
  • Display existing partitions

    You’ll see the /dev/nvme0n1p1

  • Delete the partition
  • Verify the partition table

    You won’t see the /dev/nvme0n1p1 no more since we deleted it using d

  • Save changes and exit
  • Verify
    lsblk

    No more partition!

Notes

  • Ensure the partition is not mounted or activity in use.
  • If the partition contains data you need, back it up first.
  • Deleting a partition removes its partition-table entry; it does not securely erase the data.
  • After deletion, the disk space becomes unallocated and can be used to create a new partition.