How to Wipe a Hard Drive on Any Operating System

By Eric Hamilton
— Last Updated:
2020-03-29T14:54:24+00:00


There are many reasons to format a drive, including setting up a new computer, correcting drive errors, or needing a clean install of your operating system. Security also comes into play, as you’ll want to rid any discarded storage device of data, especially if it’s sensitive.

In this guide, we’re going to walk you through how to format your hard drive in Windows, macOS and Linux. Formatting has become a term used interchangeably with wipe, delete and erase, but they are not.

Deleting a file tells the OS that the space it occupied is now addressable for new data to be written, but the old data is still there. Likewise, a simple or quick format isn’t a secure wipe, it just makes room for a new file system and data.

Wiping vs Deleting Files

Worse is moving files to the recycle bin in Windows or trash in macOS. That doesn’t even remove the file, as it’s just put out of view until it is permanently deleted later. Deleted files are easily recoverable with data recovery software.

Wiping a drive, on the other hand, removes everything on it — stored, deleted or otherwise. You can do so with data destruction software using data sanitization methods, though recent versions of macOS and Windows include the same features to an extent.

Wiping is usually only done once you’re finished with the storage media or if you want the securest formatting possible. It’s the best way to ensure your data is truly gone and not recoverable. Unrecoverable means that it’s gone forever, so make sure to use one of our best online backup services before doing so.

Windows and macOS offer write-zero data sanitization with formatting options, so long as you choose to forego a quick format. The write-zero method is carried out by filling in all bits of data with zeros. That can be done in one pass or multiple, depending on the level of security desired. The process cannot be undone and protects the data from unwanted access and recovery.

Before we start, it’s important that you’ve backed up your important data. If you need help selecting an online backup provider, check out our best cloud backup guide.

Formatting a Drive in Windows

You can manually format a drive in Windows through the disk management tool or command prompt. For simplicity’s sake, we’re going to show how to do it with the disk management tool. It is part of every version of Windows (learn how to check your version here) and can be opened via computer management, Cortana or command prompt.

Keep in mind that you’ll need to partition the drive you are formatting if it has never been used or has been wiped before.

This guide to partitioning for Windows will help.

Step 1: Open disk management. It’ll look like this.

diskmanagment1

Step 2: Navigate to the drive that is to be formatted. Right-click and select “format…”

diskmanagment2

Step 3: A new format window should open with a corresponding drive letter. If this is a new drive, Windows will assign a drive letter. In the volume label box, give your drive a name, otherwise it will be called “new volume” by default. Stick with the New Technology File System and default allocation unit size, unless you have a specific need to do something else.

Step 4: The “perform a quick format” box will already be checked. There are a couple of reasons to uncheck it. A standard (non-quick) format will look for errors on the drive, as well as performing a one-pass write-zero. That is good for used drives, as it provides a basic level of protection against unwanted data recovery.

diskmanagment3

Step 5: At this point, the format will begin. The time it takes to finish depends on the size of the drive being formatted and the speed of your computer. Once it’s done, the new drive will display in the bottom half of the disk management window, along with a “healthy” status.

diskmanagment4

That’s it for Windows. Next, we’ll look at macOS.

Formatting a Drive in macOS

Formatting a drive in macOS isn’t unlike doing so in Windows. The biggest difference will be in the file system, as the operating systems use native file systems that are incompatible with each other. That said, you can format the drive using a file system that is compatible with both if you need to work across platforms.

As with Windows, if you’re dealing with a new, never-formatted media, it’ll need to be partitioned. Check out this guide to partitioning on a Mac for help.

Step 1: To launch disk utility, navigate to applications. From there, go to utilities and select disk utility. You can also press Command + Space to bring up spotlight, then type “disk utility.” You should see your drives on the left and information about them on the right.

macdiskutility1

Step 2: After you’ve selected the drive to be formatted, select the “erase” option at the top.

macdiskutility2

Step 3: In the erase window, give the volume a name and select the file format. By default, macOS will use the Apple File System. If you plan to use the drive on both macOS and Windows, choose the exFAT file format. Otherwise, APFS is fine, unless you need something specific.

macdiskutility3

Step 4: Finally, click the “security options” button, then choose between “fastest” and “most secure.” Selecting “fastest” will do a quick format, which deletes files and leaves data intact and easily recoverable. Moving the slider to the right will enable a one-pass write-zero. Moving the slider all the way to the right to “most secure” will make it overwrite the drive seven times.

That meets the U.S. Department of Defense 5220-22-M standard and should be the option you choose if you want the securest wipe macOS offers.

macdiskutility5

Step 5: Click “erase” and wait while the drive is formatted.

Formatting for Linux

When formatting for Linux, your mileage can vary based on the distribution you use. There are a handful of tools for most flavors, though. A couple of them require familiarity with the command line. There are also popular utilities, such as GParted, and the distribution of Linux you are using may have come with one.

Most variants of Linux come with two tools for securely wiping a drive: the dd command and the shred tool. You could use dd or shred to wipe the drive, then create partitions and format it with a disk utility.

To wipe a drive using the dd command, it’s important to know the drive letter and partition number. Also, be sure the drive is unmounted. To do that, use the unmount command. To use the dd command, open the command line and enter the following:

  • sudo umount /dev/sdXY -l
  • sudo dd if=/dev/urandom of=/dev/sdX bs=10M

Note that X and Y represent your drive letter and partition, respectively. The process will make several passes over the drive, writing random zeros on top of your data.

To wipe a hard drive with the shred tool, enter the following (where X is your drive letter):

  • sudo shred -vfz /dev/sdX

The shred utility will make three passes over your drive, writing random characters on top of your data.

Both methods are time-intensive, so it’s best to plan for that or let them run overnight.

Now that the drive is wiped, it’s ready to be formatted.

To get GParted:

  • sudo apt-get install gparted
  • gksu gparted

Once you have it, click “device,” then click “create partition.”

formatting Linux hard drive

By default, GParted will create a partition using all the unallocated space. That is fine, assuming you don’t need multiple partitions for a dual boot system or root directory for Linux.

  • Now, click the “apply” button to create the partition. Right-click the new partition and select “format.”


Final Thoughts

Wiping and formatting are not the same thing and they are done differently depending on your operating system. While this guide is more about how to protect data you no longer need or want, it’s also important to protect the data on your current drives.

Sign up for our newsletter
to get the latest on new releases and more.

To that end, be sure to read our how to encrypt your hard drive guide. Do you have any tips or tricks for wiping a hard drive we haven’t covered? Let us know in the comments below. Thanks for reading.