Terminal cannot erase free space

Discussion in 'OS X El Capitan (10.11)' started by AppleFan22, May 2, 2016.

  1. AppleFan22 macrumors regular

    Joined:
    Jan 3, 2014
    #1
    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?
     

    Attached Files:

  2. richard2 macrumors regular

    richard2

    Joined:
    Oct 21, 2010
    Location:
    England, United Kingdom
    #2
    Why not just enable FileVault instead of relying on a depreciated feature?
     
  3. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #3
    Your disk1 is a logical volume, and not the physical drive.
    You should be able to erase free space on the physical volume disk0s2
     
  4. AppleFan22 thread starter macrumors regular

    Joined:
    Jan 3, 2014
    #4
    FileVault just encrypts all the data, but I want to make sure it's completely gone.
    --- Post Merged, May 2, 2016 ---
    Awesome, I'll give this a go right now, thank you!
     
  5. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #5
    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.
     
  6. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #6
    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.
     
  7. AppleFan22 thread starter macrumors regular

    Joined:
    Jan 3, 2014
    #7
    Bad news, it's not working! It says "Erasing freespace only works on mounted and writable volumes"! What now?
    --- Post Merged, May 2, 2016 ---
    Just as an update though: I shall be turning on FileVault very soon
     

    Attached Files:

  8. richard2 macrumors regular

    richard2

    Joined:
    Oct 21, 2010
    Location:
    England, United Kingdom
    #8
    Try the following command:

    sudo diskutil secureErase freespace 1 /
     
  9. AppleFan22 thread starter macrumors regular

    Joined:
    Jan 3, 2014
    #9
    As with all sudo commands, it asked for my password, and that seems to be it, for now. Looks like it's working!
    --- Post Merged, May 2, 2016 ---
    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.
     
  10. AppleFan22 thread starter macrumors regular

    Joined:
    Jan 3, 2014
    #10
    Good news! the sudo command worked! Something I'm going to have to keep handy! Thank you!!
     
  11. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #11
    I'd definitely go with FV over trying to erase free space as @DeltaMac stated. It ensures the safety of your data, but makes even deleted data that much harder to retrieve.
     
  12. Fishrrman macrumors G3

    Joined:
    Feb 20, 2009
    #12
    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?
     
  13. throAU macrumors 601

    throAU

    Joined:
    Feb 13, 2012
    Location:
    Perth, Western Australia
    #13
    Because some people do not like change, and would prefer less security :)
     
  14. niji macrumors 6502a

    niji

    Joined:
    Feb 9, 2003
    Location:
    tokyo
    #14
    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.
     
  15. richard2, May 4, 2016
    Last edited: May 4, 2016

    richard2 macrumors regular

    richard2

    Joined:
    Oct 21, 2010
    Location:
    England, United Kingdom
    #15
    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.

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

Share This Page