SecureErase (Category 4 - DoE 3 - Pass Secure Erase) Macintosh HD - in Terminal app

iMac -2012 - MacOS Catalina

I want to secure-erase my entire HD, not just the free space. The end goal is to sell my computer


I entered all of the required information into terminal to activate a category 4 secure erase.

After hitting the enter key, a line appears stating: "Ownership of the affected disk is required."


My question: What ownership information is required to activate the category 4 secure erase process?


------------------------------------------------------------------------------------------------------------

Below is a copy of all of the information displayed in the active Terminal window:

------------------------------------------------------------------------------------------------------------


Last login: Wed Oct 19 22:47:31 on ttys000

[—————— @ ———— iMac ~ % diskutil secureErase 4/Volumes/Macintosh\ HD]

Usage: diskutil secureErase [freespace] level

MountPoint | DiskIdentifier | DeviceNode

"Securely" (BUT SEE "man diskutil" FOR MODERN LIMITATIONS) erases either a

whole disk or a volume's freespace. Level should be one of the following:

0 — Single-pass zeros.

1 — Single-pass random numbers.

2 — US DoD 7-pass secure erase.

3 — Gutmann algorithm 35-pass secure erase.

4 — US DoE 3-pass secure erase.

Ownership of the affected disk is required.

Note: Level 2, 3, or 4 secure erases can take an extremely long time.

—————— @ ———— iMac ~ % []

iMac

Posted on Oct 19, 2022 11:41 PM

Reply
Question marked as Top-ranking reply

Posted on Oct 23, 2022 6:27 PM

SteveHS wrote:

Thank you, John.

I tried your suggestion of adding the space after the number 4 : diskutil secureErase 4 /Volumes/Macintosh\ HD

That resulted in the following statement: "Could not find the disk hd".

I think you may have made a mistake typing the command by omitting the backslash after "Macintosh" in the path even though you are showing it in your post. The backslash is critical for the correct path in order to include the space in the path. Instead of using the backslash in the path to "escape" the space, you can include the path within double-quotes instead. Either of the two following commands are equivalent and should work:

diskutil  secureErase  4  /Volumes/Macintosh\ HD

diskutil  secureErase  4  "/Volumes/Macintosh HD"


(Please note - this procedure WAS NOT carried out in RECOVERY MODE)

Was it carried out while booted from a macOS USB installer? Or while the Mac was in Target Disk Mode connected to another Mac? Or an external full macOS boot drive? Otherwise, you cannot erase the drive you are booted from.


Similar questions

43 replies

Oct 23, 2022 5:11 PM in response to HWTech

"...never use these options for an SSD as SSDs don't work the same way as hard drives".


In that case, I've come to a dead-end.


Had I known that this particular drive was a critical point to mention from the start, this entire discussion would have ended substantially sooner.


Perhaps that could explain why I got the "Ownership of the affected disk is required." after entering my parameters.


Oct 24, 2022 1:05 AM in response to SteveHS

These are the results from the (2) recently suggested parameters spacing (in recovery mode)::


[-bash-3.2# diskutil secureErase 4 /Volumes/Macintosh\HD

Could not find the disk /Volumes/MacintoshHD

[-bash-3.2# diskutil secureErase 4 "/Volumes/Macintosh HD"

A whole disk must be specified when doing secureErase without the

"freespace" option; if you need to wipe a single partition, you must

use diskutil zeroDisk or diskutil randomDisk but you will subsequently

need to reformat (newfs) the partition with "diskutil eraseVolume"

[-bash-3.2#

Oct 21, 2022 11:14 AM in response to John Galt

Thank you for providing an alternative solution, John. Greatly appreciated.


However, since I've accomplished a level 4 Secure Erase equivalent on the Windows OS (many times in the past) with no problems whatsoever, I'm still focused on being able to accomplish this process on the Mac operating system.


I've had numerous phone conversations with Apple technical support team members.

The consistent response is "Apple does not provide support for Terminal".


I'm confident that it IS possible to perform a level 4 secure erase successfully on the MacOS.


In the meantime, I'll leave this post open (considering it unresolved as of this date) and continue my online research.


Thank you again to those who've responded to my post.

Oct 22, 2022 12:55 AM in response to HWTech

Thanks for your reply and for providing a link to and information about Knoppix, HWTech.


FYI: The hard drive was replaced in 2020.


I appreciate your suggestion, but I'm not comfortable with nor do I have even rudimentary Linux-based knowledge of booting from a Knoppix LInux USB stick without proper supervision.

If something were to happen during the process (possibly making the HD inoperable), that would put me in a far worse position than I'm currently in.


I continue to look for a solution that allows me to use Terminal as it is part of the MacOS.


Up to this point, the overwhelming consensus has been Terminal-avoidance, akin to the third rail of a subway line.

I hope to get a better understanding of why that is and if what I'm seeking can be accomplished successfully.

Oct 22, 2022 12:25 PM in response to John Galt

Thank you again, John.

Performing a level 0 may be adequate for the majority of end-users, but I'm not in that category.


You are correct in pointing out that I eventually intend to sell my iMac, but only after I complete a level 4 Secure Erase procedure on the hard drive.


I want to ensure I've taken the highest level of security available to thwart any attempts to tamper with the hard drive to extract data from it. The odds of that happening are probably highly unlikely, but I'm still going to move forward with the secure erase procedure using Terminal.


And, yes, I could just remove the hard drive and hammer it into oblivion, but that's not what I wish to do.

Oct 22, 2022 4:28 PM in response to BobHarris

Thank you for your suggestion, Bob.


I'm going to assume that you've never had an opportunity to remove a hard drive from an iMac. It's a dreaded task even for the most tech-savvy Mac computer technician. I've had many opportunities to watch them do just that, and each time the struggle to open the iMac to access the hard drive was very apparent and eventually accomplished with tremendous difficulty. There was an equal struggle, again with much difficulty, in reassembling the iMac.


So (from my experience) this is definitely not a task for the uninitiated or, for that matter, any average mere mortal.


I have accomplished this same task many times with Windows-based PCs with no problems whatsoever. But getting into one of those systems only involved removing a few screws.

Oct 22, 2022 8:51 PM in response to SteveHS

No, you assume wrong. I’ve replaced the hard drive in my 27” iMac twice, replaced the DVD/CD drive with an SSD, added a custom SATA cable with a temperature sensor, upgraded RAM to 32GB and removed the SSD and disk before retiring my 9 year and 9 month old iMac. 


You could also put the iMac into target disk mode, and if you have the right cables and the other system will accept those cables, you could do all this without taking the drive out of the iMac.

Oct 22, 2022 10:28 PM in response to BobHarris

I stand corrected.

Glad to hear you've had positive and successful experiences with cracking open and accessing the iMac's internal components.


It's still not a task I want to perform.


I will move forward with finding someone who can guide me through a level 4 Secure Erase procedure.

When I find that individual and have accomplished the procedure, I will record the procedure here.


Thanks again, Bob and everyone else who took time out from their day to offer constructive suggestions.

It's always interesting to discover just how many ways any one problem can be solved especially when so many individuals can be reached to offer assistance.

Oct 23, 2022 11:26 AM in response to SteveHS

It seems you have a mission to figure out how to use the command line to get the result you want since you don't seem to want to use @John Galt's excellent suggestion. This is perfectly fine as I too like to experiment just to prove that something can be done even if there are other alternatives, but keep in mind not very many people are familiar with the macOS command line utilities especially with some of their lesser used options like the multi-pass secure erase.


The bootable Knoppix USB stick may also have a utility available to allow such secure erase like you want through a GUI interface, although I don't recall which app it is since Knoppix includes hundreds of apps by default.


Another option would be DBAN, but it can only be booted from a CD on a Mac since it doesn't support UEFI booting from USB. It seems someone took the open source erase utility utilized by DBAN and created ShredOS which does support booting to UEFI systems like a Mac from a USB stick. You will need to use the .img version since the .iso version currently does not support UEFI booting. Use the downloaded ShredOS .img file as a source for Etcher (Mac/Windows/Linux) in order to create a bootable ShredOS USB stick. Then Option Boot the USB stick and select the orange icon labeled "EFI".


I'm just providing these options in case someone else wants to perform a multi-pass secure erase of their hard drive (never use these options for an SSD as SSDs don't work the same way as hard drives and as it will also just wear out the SSD prematurely) and may not want to use the command line.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

SecureErase (Category 4 - DoE 3 - Pass Secure Erase) Macintosh HD - in Terminal app

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.