How to erase all partitions on hard drive

What Are Hard Drive Partitions?

Before diving into deletion methods, it’s important to understand what partitions are. A partition is a logical section of a hard drive that functions like a separate disk. It can contain files, programs, or even an operating system. You can have multiple partitions on a single drive for instance:

A C: drive for Windows

A D: drive for backups or games

A hidden recovery partition

An EFI System Partition (ESP)

Partitions allow for efficient organization and management, but too many — or the wrong configuration — can lead to complications. Erasing all partitions wipes the slate clean, leaving you with unallocated space that can be repartitioned as needed.

Reasons to Erase All Partitions

There are numerous scenarios where removing all partitions is the best course of action:

Installing a new operating system from scratch

Repurposing a hard drive for storage

Eliminating malware, ransomware, or corrupted file systems

Removing bloatware or manufacturer-created partitions

Selling, donating, or disposing of the drive

Troubleshooting persistent system errors

Crucial Warnings and Preparations

Before you begin, keep these critical points in mind:

1. Back Up All Important Data

Erasing all partitions will permanently destroy every file and folder stored on the hard drive. Ensure that you transfer essential documents, photos, videos, or applications to another storage device or cloud service.

2. Know Your Boot Drive

If you plan to erase the drive that contains your current operating system, you cannot do it while booted into that OS. You’ll need to use installation media, a recovery environment, or a bootable USB.

3. Unplug Other Drives

To prevent accidental deletion of the wrong drive, unplug all drives except the one you plan to erase — especially when working with command-line tools.

Method 1: Erase All Partitions on Windows Using DiskPart

Windows provides a powerful command-line utility called DiskPart that can remove all partitions in one session.

Steps:

Open Command Prompt as Administrator

Press Windows + S, search for cmd, right-click Command Prompt, and select Run as administrator.

Launch DiskPart

bash

CopyEdit

diskpart

List Available Disks

bash

CopyEdit

list disk

Identify the disk number of the hard drive you want to wipe. Double-check to avoid choosing the wrong one.

Select the Target Disk

bash

CopyEdit

select disk X

Replace X with the correct disk number.

Clean the Disk

bash

CopyEdit

clean

This command removes all partitions, leaving the disk unallocated.

(Optional) Securely Wipe the Disk

If you’re preparing the drive for resale:

bash

CopyEdit

clean all

This overwrites every sector with zeros — a secure wipe that may take hours on large drives.

Exit

bash

CopyEdit

exit

Now, your hard drive is free of partitions and ready for new formatting.

Method 2: Use Windows Installation Media

If the target drive contains your active Windows installation, you’ll need a bootable USB.

Steps:

Create Windows Installation Media

Use Microsoft’s Media Creation Tool to make a bootable USB.

Boot from USB

Restart your computer and enter the BIOS/UEFI settings (Del, F2. Esc, or F12. depending on your system).

Set the USB drive as the primary boot device.

Start Windows Setup

Choose your language, then click Install Now.

When prompted, choose Custom: Install Windows only (advanced).

Delete All Partitions

You’ll see a list of partitions on the hard drive.

Select each one and click Delete until all are gone.

You will be left with “Unallocated Space”.

Proceed with Installation or Shut Down

You can either proceed with installing Windows or shut down and use the drive for other purposes.

Method 3: Use macOS Disk Utility or Terminal

Option A: Disk Utility (GUI)

Open Disk Utility

Go to Applications > Utilities > Disk Utility.

Show All Devices

In the top-left, click View > Show All Devices to see full drive hierarchies.

Select the Physical Drive

Not just the volume (e.g., “Macintosh HD”), but the actual hardware device.

Click Erase

Set the format to APFS or Mac OS Extended (Journaled), and use GUID Partition Map.

Erase

This will remove all volumes and partitions and format the disk with a single new one.

Option B: Terminal (diskutil)

Open Terminal

bash

CopyEdit

diskutil list

Find Your Disk ID

For example, /dev/disk2.

Erase the Entire Disk

bash

CopyEdit

diskutil eraseDisk JHFS+ CleanDrive /dev/disk2

Replace JHFS+ with the desired format, and CleanDrive with any volume name you want.

Method 4: Linux – Erase All Partitions Using GParted or Terminal

Option A: GParted (GUI)

Install GParted

bash

CopyEdit

sudo apt install gparted

Run GParted as Root

bash

CopyEdit

sudo gparted

Select the Target Disk

Choose your hard drive from the dropdown in the top-right.

Delete All Partitions

Right-click each partition and select Delete.

Apply all operations by clicking the green checkmark.

Create New Partition Table (Optional)

Go to Device > Create Partition Table, choose gpt or msdos.

Option B: Terminal (fdisk + wipefs)

List Drives

bash

CopyEdit

sudo fdisk -l

Open the Disk

bash

CopyEdit

sudo fdisk /dev/sdX

Delete All Partitions

Press d to delete.

Repeat until all partitions are removed.

Write Changes

Press w to save and exit.

Wipe Filesystem Signatures (Optional but Recommended)

bash

CopyEdit

sudo wipefs -a /dev/sdX

Method 5: Use a Bootable Partition Manager

For advanced disk management, a dedicated bootable partition manager can be ideal. Examples include:

GParted Live

Parted Magic

MiniTool Partition Wizard Boot Disk

EaseUS Partition Master (Bootable)

Steps:

Download and Burn ISO

Use Rufus or balenaEtcher to create a bootable USB.

Boot From USB

Access BIOS/UEFI and boot from the USB drive.

Erase All Partitions

Use the tool’s GUI to delete every partition on the disk.

Apply changes and reboot.

These tools also support advanced options like disk cloning, secure erasure, and partition recovery.

Secure Erasure Options

If privacy is a concern — such as when selling or discarding a drive — a secure erase ensures that deleted data cannot be recovered with recovery software.

Windows: DiskPart

bash

CopyEdit

clean all

Linux: shred

bash

CopyEdit

sudo shred -v -n 3 -z /dev/sdX

-n 3: Three overwrite passes

-z: Final pass of zeroes for disguise

macOS: Secure Erase (Older Versions)

Disk Utility used to include a “Security Options” button. On SSDs, Apple recommends FileVault encryption before deletion, as secure erase is no longer available.

Manufacturer Tools:

Brands like Samsung, Western Digital, Seagate, and Crucial offer utilities that support Secure Erase or Sanitize, optimized for their SSDs and HDDs.

Common Errors and Fixes

“Cannot Delete EFI Partition”

The EFI System Partition is protected. You must use:

bash

CopyEdit

delete partition override

in DiskPart, or use gdisk on Linux.

“Access Denied” in Terminal

Ensure you’re running tools with administrative or root privileges.

“Drive in Use”

Unmount or detach the drive if it’s being accessed by the OS or background services.

Special Cases

Erasing a System Drive

You cannot erase the active system drive from within the operating system. Use a live USB or installation media.

External USB Drives

The same steps apply to USB drives and external HDDs. Just make sure you select the correct disk to avoid catastrophic data loss.

Erasing SSDs

Avoid overusing dd or shred on SSDs. Instead, use the manufacturer’s secure erase tool, which triggers internal hardware-level wipes optimized for flash storage.

After Erasing: What’s Next?

Once you erase all partitions, the drive will show as unallocated space. You can now:

Create new partitions and format them using your OS’s tools

Install a fresh copy of an operating system

Use the drive as a secondary storage device

Creating a New Partition (Windows)

Open Disk Management (Windows + X > Disk Management)

Right-click unallocated space > New Simple Volume

Follow the wizard to assign drive letter and file system

Creating a New Partition (macOS)

Use Disk Utility to create a new volume with desired format and name.

Creating a New Partition (Linux)

Use gparted or parted to create and format new partitions.

Final Tips and Best Practices

Label Partitions Clearly: Always name new volumes so you can easily identify their purpose.

Use GPT for Modern Systems: GPT (GUID Partition Table) supports UEFI and drives over 2TB.

Avoid Fragmentation: When repartitioning frequently, defragment drives afterward (for HDDs).

Always Double-Check Drive Selection: Mistakes in drive selection are costly.

Erasing all partitions on a hard drive is a powerful operation that gives you a clean slate. Whether you’re doing it for performance, security, system installation, or storage management, the process is straightforward when handled correctly. From Windows to macOS to Linux and even with third-party tools — you now have the knowledge to perform this task confidently.

About us and this blog

Panda Assistant is built on the latest data recovery algorithms, ensuring that no file is too damaged, too lost, or too corrupted to be recovered.

Request a free quote

We believe that data recovery shouldn’t be a daunting task. That’s why we’ve designed Panda Assistant to be as easy to use as it is powerful. With a few clicks, you can initiate a scan, preview recoverable files, and restore your data all within a matter of minutes.

Subscribe to our newsletter!

More from our blog

See all posts