Securely erase a disk in the terminal in OS X El Capitan
This article was last edited over 3 years ago. Information here may no longer be accurate. Please proceed with caution, and feel free to contact me.
It took me longer than I’d like to admit to learn how to use
the secureErase
command to shred a disk using
diskutil in OS X El Capitan.
# This works, using one pass of random data.
# Replace `disk3` with whatever you need!
diskutil secureErase 1 /dev/disk3
I found the documentation for the command slightly confusing.
diskutil secureErase [freespace] level MountPoint|DiskIdentifier|DeviceNode
I’m not used to a whole parameter being optional. It turns
out that you either use the freespace
flag, or you
omit it completely, and that’s what the
[]
around it indicate.
So if you would like to wipe a disk entirely, including free
space, simply omit freespace
from your command.
Feel free to contact me with questions or feedback regarding this
article.