Erasing an Encrypted HFS+ Drive

I had a heck of a time erasing an encrypted HFS+ drive. You can probably save a few hours by learning from my experiences.

By Matthew Malinowski, 2012-12-06

Short Version:

This is if you don't care about losing the contents of your drive. If you are having trouble erasing a drive with an encrypted partition using Disk Utility (or diskutil CLI), first note that there are two disks for your one drive: diskutil list. We'll call them disk2 and disk3 for example. disk2 has the fiddly bits, particularly the GUID partition scheme and Apple_CoreStorage partition. Erase disk2 and specify a partition scheme like this: diskutil eraseDisk HFS+ $yournewvolumename MBR disk2. (Replace HFS+ with your preferred file system - diskutil listFilesystems - and MBR with your preferred partition scheme - MBR for PC, GPT for Intel Macs.) You should be good to go.

Long Version:

Today was the latest battle with Apple's Disk Utility.

At some point Apple let us create encrypted drives in Disk Utility, so for every drive I could, I switched.

I needed to erase and repartition one of these drives today.

Disk Utility was not interested in doing this. I have done so many things that I can hardly remember what I did, but basically, I tried to straightforwardly erase a drive with an encrypted partition, and Disk Utility did not do this. It did break everything so that the passphrase for this drive didn't work any more, nothing would mount, etc.

I tried everything I could find that other people did but, as usual, didn't read the man page. After more than an hour trying other things, I read the man page and within 10 minutes got the whole drive erased, including the stupid encrypted partition.

So, if you have a drive with an encrypted HFS+ partition and you would like to erase it, read on.

Remember: this is if you do not need the contents of this drive. It's going to get erased.

This is kind of speculation because I've done so many things today and didn't record what I did.

Open Terminal, run diskutil list. This will list all your disks, not all of your drives. You'll almost certainly see more disks than physical drives.

For one, you're probably going to see two disks for your boot disk, like this:

   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:          Apple_CoreStorage                         120.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           *120.1 GB   disk1

disk0 contains the partition scheme, the EFI partition (which is a bootloader I believe), a CoreStorage partition (if your boot disk is encrypted), and a recovery drive for recovery mode. disk1 will be your drive itself that you boot from.

You're probably also going to see something similar for your encrypted drive - two disks, one with the little random stuff (like a GUID partition scheme) and one with the actual encrypted partition.

Here's the big tip: focus on the one with the little random stuff.

So, you've got disk2 and disk3 for your target drive. Unmount everything from both: diskutil unmountDisk force disk2 and diskutil unmountDisk force disk3. Then erase disk 2: diskutil eraseDisk HFS+ $yournewvolumename MBR disk2. Momentarily, you should be in business.

Note that I arbitrarily picked two things: HFS+ as format, MBR as partition scheme. You can pick other stuff for format (diskutil listFilesystems shows a list). Options for partitioning scheme are APM, MBR, and GPT. APM is for PPC Macs, MBR is for PCs, GPT is for Intel Macs. Partition scheme is optional and I am pretty sure I ran this command without partition scheme 800 times to no avail. Specifying a partition scheme I think is key to overwriting the whole disk.

Back to Blog Index...