2

A friend told me that when you delete a file on your Mac in the normal way it actually stays where it is, but it is just no longer usable by your Mac. The addition of more files to your Mac causes them to overwrite the space taken by those unusable files that you deleted previously.

If this is true then I'm thinking if your Mac got into the wrong hands, that individual(s) could actually recover files that you have deleted previously (which could be potentially harmful).

Therefore how do you delete them securely first to prevent such potential catastrophe (preferably using the Terminal command) ?

  • Do you have a SSD or a hard disk? – user151019 Oct 8 '13 at 12:23
  • @Mark hard disk – Simon Oct 8 '13 at 12:32
  • 2
    Alternatively you could enable FileVault 2 on your drive which makes it significantly more difficult for the casual attacker to recover deleted files. – nohillside Oct 8 '13 at 14:56
  • ☑︎ Empty trash securely in Finder Preferences will save you from going back to the Terminal. – sam May 21 '15 at 21:14
4

From the Terminal app you can use the program srm (secure remove). Simply start Terminal, then type:

srm <filename>

For more info, take a look at the man page. Excerpt:

srm removes each specified file by overwriting, renaming, and truncating it before unlinking. This prevents other people from undeleting or recovering any information about the file from the command line.

  • 2
    srm uses the 35-pass Gutmann algorithm by default. You can use -s for a single pass of random data (which should be secure enough in practice) or -m for 7 passes of data. – Lri Oct 8 '13 at 14:38
  • 3
    The asker did note he had a hard disk in comments, but it should be added that srm is likely not suitable for SSD use. Rewriting on an SSD generally results in the old data being "hidden" and a new sector being written and moved into its place. Eventually, it may resurface and be rewritten with new data, but depending on your attacker's resources, it may not be enough. – zigg Oct 8 '13 at 14:45
  • srm is OK for HD and SSD. I promote the @Lauri answer for 2 reasons. The 35-pass was necessary for old disks and in a situation where the recovery is started immediately after the erasing. In real life, after a single pass 2 things happen. The freed and erased space is overwritten by the OS. No one is able to recover where the erased data was, because there are erased area all over the disk surface and nothing look more like an erased area than the next one. – dan Oct 16 '13 at 21:52
  • srm seems not to be a good option for SSDs. – Jinhua Wang Feb 13 at 9:13
1

If you have an HDD, you can also erase free space from Disk Utility:

If you have an SSD, it is not possible to erase free space from Disk Utility in 10.7 and later. See http://support.apple.com/kb/HT3680:

Note: With OS X Lion and an SSD drive, Secure Erase and Erasing Free Space are not available in Disk Utility. These options are not needed for an SSD drive because a standard erase makes it difficult to recover data from an SSD. For more security, consider turning on FileVault 2 encryption when you start using the SSD drive.

I don't know if it is possible to use an application like Data Rescue to recover files from an SSD though. diskutil secureErase freespace can also be used with an SSD, but I don't know if it makes files any more difficult to recover.

  • SSDs and Hard disks are totally different here. SSDs data can be recovered as they are not overwritten, just pointers moved, but I think you have to go through another controller not the standard one – user151019 Oct 8 '13 at 15:34
  • @Mark SSDs "evaporate" their data at their leisure. They will permanently remove data when they see fit. – Andrew Larsson Oct 8 '13 at 16:51
0

You can refer this page to see the steps to delete the free space from the hard-drive securely.

P.S, the commands mentioned on that page will only erase the free space available. It will NOT erase the contents of your hard drive. You should only run commands like these on drives that are healthy. Running a command like this on an older or unhealthy drive can cause further damage to a failing drive.

  • 1
    Can you please describe what to do and not just give a link – user151019 Oct 8 '13 at 13:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .