Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

I want to erase free space on my mac SSD. I don't care about how it will shorten the usefulness and I don't believe that encryption and TRIM take care of this. How do I secureerase free space?

How do I secure erase free space? Please don't tell me that it is bad for the SSD. Also, please don't tell me to encrypt the disk or let TRIM handle it "eventually." Terminal has a secure erase function in diskutil. I used it before on an SSD with no problems but now it can't be used for reasons that make no sense.

MacBook

Posted on Sep 7, 2020 6:40 AM

Reply
Question marked as Best reply

Posted on Sep 7, 2020 7:40 PM

yushuu wrote:

• It is harmful to an SSD
• It is not needed when an SSD is using TRIM (since the blocks are erased fairly quickly after data has been deleted).
• Due to how SSDs work internally erasing the "free" space may not overwrite the data you are looking to shred because once a NAND block is recycled the OS doesn't have access to that particular block.
Whether it is harmful to the SSD is irrelevant. If I am willing to take that risk, so be it.

Then do as @etresoft suggests, but that still will not guarantee the NAND block with deleted data is zeroed out because once a NAND block has been marked as recycled the OS loses track of it since the SSD puts it into a hidden pool of storage to be recycled and zeroed out for re-use. This is just how SSDs work.


You say TRIM deals with this "fairly quickly" but give no real time frame. The definition of "fairly quickly" is subjective.

I used Disk Utility to "erase" the physical SSD that had TRIM enabled which immediately caused all the NAND blocks visible to macOS to become zeroed. The same thing will happen when the NAND block containing the deleted data is recycled. If you want to be sure your data is safe, then use Filevault to encrypt the whole drive.


The last bullet I just don't believe. How is it possible that the OS does not have access to a particular block. Are you saying that a recycled NAND gate is useless once it is recycled?

At the end of the day, the OS must know where free space is located. It has to. And since it knows where free space is it should have no trouble writing 1s and 0s in that space. It does this in the course of normal disk management when the user stores a file of any type. What would happen if, for example, I had 150GB of free space, created a file that has only 0s in it, saved the file, thereby using all of the remaining free space, then delete the file?

Read up on how SSDs work internally. Be prepared for a lot of technical details. Here is an article which provides some basic information about why "shredding" a file or zeroing out unused areas doesn't work with SSDs. The article also points out how the OS and some apps make "shredding" difficult to impossible. This article also recommends using file/folder encryption or better yet full drive encryption if the data is sensitive.

https://www.howtogeek.com/234683/why-you-cant-securely-delete-a-file-and-what-to-do-instead/


As best I can tell, Windows allows secure erase of free space.

I don't use Windows anymore and I'm not sure exactly how this Windows feature works. But that is Windows. If you want that feature, then install Windows. The feature you are looking for no longer exists with macOS for the reasons I've already mentioned.


You can always provide product feedback to Apple here:

https://www.apple.com/feedback/

4 replies
Question marked as Best reply

Sep 7, 2020 7:40 PM in response to yushuu

yushuu wrote:

• It is harmful to an SSD
• It is not needed when an SSD is using TRIM (since the blocks are erased fairly quickly after data has been deleted).
• Due to how SSDs work internally erasing the "free" space may not overwrite the data you are looking to shred because once a NAND block is recycled the OS doesn't have access to that particular block.
Whether it is harmful to the SSD is irrelevant. If I am willing to take that risk, so be it.

Then do as @etresoft suggests, but that still will not guarantee the NAND block with deleted data is zeroed out because once a NAND block has been marked as recycled the OS loses track of it since the SSD puts it into a hidden pool of storage to be recycled and zeroed out for re-use. This is just how SSDs work.


You say TRIM deals with this "fairly quickly" but give no real time frame. The definition of "fairly quickly" is subjective.

I used Disk Utility to "erase" the physical SSD that had TRIM enabled which immediately caused all the NAND blocks visible to macOS to become zeroed. The same thing will happen when the NAND block containing the deleted data is recycled. If you want to be sure your data is safe, then use Filevault to encrypt the whole drive.


The last bullet I just don't believe. How is it possible that the OS does not have access to a particular block. Are you saying that a recycled NAND gate is useless once it is recycled?

At the end of the day, the OS must know where free space is located. It has to. And since it knows where free space is it should have no trouble writing 1s and 0s in that space. It does this in the course of normal disk management when the user stores a file of any type. What would happen if, for example, I had 150GB of free space, created a file that has only 0s in it, saved the file, thereby using all of the remaining free space, then delete the file?

Read up on how SSDs work internally. Be prepared for a lot of technical details. Here is an article which provides some basic information about why "shredding" a file or zeroing out unused areas doesn't work with SSDs. The article also points out how the OS and some apps make "shredding" difficult to impossible. This article also recommends using file/folder encryption or better yet full drive encryption if the data is sensitive.

https://www.howtogeek.com/234683/why-you-cant-securely-delete-a-file-and-what-to-do-instead/


As best I can tell, Windows allows secure erase of free space.

I don't use Windows anymore and I'm not sure exactly how this Windows feature works. But that is Windows. If you want that feature, then install Windows. The feature you are looking for no longer exists with macOS for the reasons I've already mentioned.


You can always provide product feedback to Apple here:

https://www.apple.com/feedback/

Sep 7, 2020 10:23 AM in response to yushuu

You cannot use "diskutil" to erase the free space anymore because Apple has disabled this feature because:


  • It is harmful to an SSD
  • It is not needed when an SSD is using TRIM (since the blocks are erased fairly quickly after data has been deleted).
  • Due to how SSDs work internally erasing the "free" space may not overwrite the data you are looking to shred because once a NAND block is recycled the OS doesn't have access to that particular block.


What you want to do is not possible. TRIM happens to do exactly what you intend which is "shredding" the data once it has been deleted. The SSD's internal garbage collection routines will do the same thing eventually if TRIM is not enabled. If you don't have TRIM enabled, then make sure to uncheck "Put hard disk to sleep when possible" in the Energy Saver System Preferences so that the SSD will remain powered on when the computer is not in use so that the SSD's garbage collection routines will have time to run to perform maintenance on the SSD which includes zeroing out the recycled NAND blocks.



Sep 7, 2020 4:43 PM in response to HWTech

  • It is harmful to an SSD
  • It is not needed when an SSD is using TRIM (since the blocks are erased fairly quickly after data has been deleted).
  • Due to how SSDs work internally erasing the "free" space may not overwrite the data you are looking to shred because once a NAND block is recycled the OS doesn't have access to that particular block.

Whether it is harmful to the SSD is irrelevant. If I am willing to take that risk, so be it.

You say TRIM deals with this "fairly quickly" but give no real time frame. The definition of "fairly quickly" is subjective.

The last bullet I just don't believe. How is it possible that the OS does not have access to a particular block. Are you saying that a recycled NAND gate is useless once it is recycled?


At the end of the day, the OS must know where free space is located. It has to. And since it knows where free space is it should have no trouble writing 1s and 0s in that space. It does this in the course of normal disk management when the user stores a file of any type. What would happen if, for example, I had 150GB of free space, created a file that has only 0s in it, saved the file, thereby using all of the remaining free space, then delete the file?


As best I can tell, Windows allows secure erase of free space.

Sep 7, 2020 5:30 PM in response to yushuu

This is a marketing problem. If Apple advertised the capability to "erase free space" on an SSD, then it would take Internet haters about 5 minutes to show that some free space was not erased, they would file a bug bounty demanding $100,000, get retweeted and linked about 100k times, and be the start of a multi-billion dollar class action suit. That's why these features have been disabled for SSDs.


The easiest solution is to just encrypted the drive and you're done.


If you want a harder solution, you can write a little script to fill the hard drive with files filled with random numbers. Just make sure to write into /tmp so they will get deleted on restart. Eventually, your script will fail when it fills up. You'll have to ignore the last error on write and force a restart afterwards. Will that completely erase the free space on the disk? No, but it is as close as you'll get trying to do it manually.


And make sure to have a backup before you start. As the operating system is always running, once you fill up the disk, you'll corrupt it. So when you restart, you should probably restore from backup.

I want to erase free space on my mac SSD. I don't care about how it will shorten the usefulness and I don't believe that encryption and TRIM take care of this. How do I secureerase free space?

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