MacOS – Secure erase OS X disk via terminal

encryptionmacos

If there's an encrypted (filevault) volume, both of these methods in terminal will erase the given drive. However, what differences exist between the two? Which is more secure?

Option 1:

diskutil eraseDisk JHFS+ Macintosh\ HD disk22

Option 2:

diskutil cs list
// find logical volume group UUID
diskutil delete *UUID*

Best Answer

I think the most secure way is to use diskutil zerodisk and then follow up with either command. Both of those commands remove the reference to logical structure on the disk but a good file recovery tool would still be able to recover most material on the unstructured volume by matching file templates to successive sets of bits. You want to write over everything with 0s or garbage before you dereference the volume.

UPDATE: It was negligent of me not to mention that diskutil secureErase also exists and it combines the two commands with options for multiple passes of zeroing the disk.