Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AppleFan22

macrumors 6502
Original poster
Jan 3, 2014
279
31
This has happened to me multiple times now, and it's starting to get really annoying.

Since the (idiotic) removal of the erase free space feature that used to reside in Disk Utility, people have had to either download external apps, or use Terminal to erase free space on their disks.

The only problem is that it doesn't work for me. Any time I try to use the following command in Terminal, the attached error appears, along with the box from Photos (I have a 200 GB iCloud photo library, with originals set to download to my Mac, although when I performed this erase, the Mac was not connected to the internet).

diskutil secureErase freespace 1 /dev/disk1

However, all my photos were at the time downloaded onto my local disk, and regardless, there was at lead 145 GB remaining on the startup partition.

Any helpful suggestions?
 

Attachments

  • Screen Shot 2016-05-01 at 13.25.13.png
    Screen Shot 2016-05-01 at 13.25.13.png
    372.1 KB · Views: 1,318

DeltaMac

macrumors G5
Jul 30, 2003
13,457
4,406
Delaware
Your disk1 is a logical volume, and not the physical drive.
You should be able to erase free space on the physical volume disk0s2
 

AppleFan22

macrumors 6502
Original poster
Jan 3, 2014
279
31
Why not just enable FileVault instead of relying on a depreciated feature?

FileVault just encrypts all the data, but I want to make sure it's completely gone.
[doublepost=1462225207][/doublepost]
Your disk1 is a logical volume, and not the physical drive.
You should be able to erase free space on the physical volume disk0s2

Awesome, I'll give this a go right now, thank you!
 

KALLT

macrumors 603
Sep 23, 2008
5,361
3,378
FileVault just encrypts all the data, but I want to make sure it's completely gone.

There is no guarantee that the data is then actually gone and you are only overwriting it once with the option you chose. Apple removed such secure-erase options from Disk Utility, because they are not actually that secure. If you worry about someone retrieving your data, then disk encryption is clearly the prudent choice. Without your encryption key, the data is effectively irretrievable.
 

DeltaMac

macrumors G5
Jul 30, 2003
13,457
4,406
Delaware
FileVault just encrypts all the data, but I want to make sure it's completely gone.
...
Erasing free space does NOT "make sure it's completely gone". It just writes zeroes to free space. Data is NOT "gone", but recovery is less likely (and probably not practical :D ). If you encrypt the free space, then erase that encrypted space, that's even better.
 
  • Like
Reactions: Mr. Retrofire

AppleFan22

macrumors 6502
Original poster
Jan 3, 2014
279
31
Erasing free space does NOT "make sure it's completely gone". It just writes zeroes to free space. Data is NOT "gone", but recovery is less likely (and probably not practical :D ). If you encrypt the free space, then erase that encrypted space, that's even better.

Bad news, it's not working! It says "Erasing freespace only works on mounted and writable volumes"! What now?
[doublepost=1462227891][/doublepost]Just as an update though: I shall be turning on FileVault very soon
 

Attachments

  • Screen Shot 2016-05-02 at 23.22.49.png
    Screen Shot 2016-05-02 at 23.22.49.png
    74.7 KB · Views: 650

AppleFan22

macrumors 6502
Original poster
Jan 3, 2014
279
31
Try the following command:

sudo diskutil secureErase freespace 1 /

As with all sudo commands, it asked for my password, and that seems to be it, for now. Looks like it's working!
[doublepost=1462228786][/doublepost]So far, we're at 12%, and I physically cannot stay up all night to be there for this, so I'm just gonna let it run on it's own.
 

AppleFan22

macrumors 6502
Original poster
Jan 3, 2014
279
31
Good news! the sudo command worked! Something I'm going to have to keep handy! Thank you!!
 

Fishrrman

macrumors Penryn
Feb 20, 2009
28,340
12,458
richard2 wrote above:
Try the following command:
sudo diskutil secureErase freespace 1 /


Could you elaborate on the "1 /" above?
What does the "1" represent?

Can this be used on volumes (not part of a fused drive) on a partitioned drive?
 

jpn

Cancelled
Feb 9, 2003
1,854
1,988
This has happened to me multiple times now, and it's starting to get really annoying.

Since the (idiotic) removal of the erase free space feature that used to reside in Disk Utility, people have had to either download external apps, or use Terminal to erase free space on their disks.

The only problem is that it doesn't work for me. Any time I try to use the following command in Terminal, the attached error appears, along with the box from Photos (I have a 200 GB iCloud photo library, with originals set to download to my Mac, although when I performed this erase, the Mac was not connected to the internet).

diskutil secureErase freespace 1 /dev/disk1

However, all my photos were at the time downloaded onto my local disk, and regardless, there was at lead 145 GB remaining on the startup partition.

Any helpful suggestions?

what kind of disk you have: SSD or what? it makes a difference. if it is SSD. apple and utilities software providers all say clearly and loudly and in unison that you should not be trying to erase so called free space. you will cause yourself problems if you do it.
 

richard2

macrumors regular
Oct 21, 2010
236
51
England, United Kingdom
Could you elaborate on the "1 /" above?
What does the "1" represent?

Firstly, be aware that diskutil can only securely erase the contents of hard discs, not solid-state discs.

Secondly, the following is the syntax of the subcommand:

secureErase freespace Level Volume

The argument Level specifies which algorithm is used to overwrite the target volume's unallocated space. A value of "1" causes a single pass of random bytes to be written. My understanding is that only a single pass of null bytes (a value of "0") is required to securely erase the contents of modern hard discs. (I used the value "1" in my command because that's what AppleFan22 wanted.)

The argument Volume specifies the target volume. A value of "/" represents the root of the system volume — it's equivalent to "/Volumes/Macintosh HD".

For more information, see the manual page for diskutil.

Can this be used on volumes (not part of a fused drive) on a partitioned drive?

Yes — diskutil securely erases unallocated space by simply creating a temporary file that occupies all of the free space on a volume.
 
Last edited:

junebug2506

macrumors newbie
Jan 7, 2018
1
0
As with all sudo commands, it asked for my password, and that seems to be it, for now. Looks like it's working!
[doublepost=1462228786][/doublepost]So far, we're at 12%, and I physically cannot stay up all night to be there for this, so I'm just gonna let it run on it's own.

The sudo command wasn't needed; that's not why it worked (although you must be a "superuser", i.e. elevated privileges, to use this command.
Just use diskutil secureErase freespace 1 /
This will clean up your drive so you can sell the computer etc.
Use diskutil man to read the manual; it explains the security levels, etc.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.