2

I need to shred files, but there are too many files and shred takes ages for each file.
Each file is 4GB.

Is there a faster tool than shred -n 1?

Strangely, shred -n 1 on a 4GB file takes MORE time than copying a 4GB file to the disk.
For the same 4GB file:

  • shred -z -n 1 : 6 minutes
  • shred -n 1 : 4 minutes
  • copy 4GB file: 3 minutes

Should I copy a 4GB file to each file? Anything smarter?

3
  • 1
    These tools would need to know the specific file types and implement specific strategies, and still would be worse than shred in all cases. For example, removing the "header" of a CSV file won't do much good. Just let it run over night.
    – Daniel Beck
    May 2, 2012 at 8:04
  • @DanielBeck: Thanks, destroying only headers was probably not a good idea, and I did more time analysis, so I reformulated my question. May 2, 2012 at 8:14
  • Thermite is faster if it meets your requirements.
    – Joshua
    Aug 22, 2015 at 22:39

2 Answers 2

3

Shred should be slower than a write of the the same size, because of your -z.

From the manual:

z, --zero
    add a final overwrite with zeros to hide shredding

If you're not trying to hide the fact that it's shredded, and just want to actually shred it, leave off the -z.

Obviously it's probably pointless to use shred if you're using ReiserFS, XFS, Ext3, some RAID systems...

1
  • +1 My bad, I was misunderstanding "--zero" as "fill with zeros instead of filling with /dev/urandom". That explains why it was taking twice as much time! It is on FAT32. May 2, 2012 at 8:29
1

The reason it takes a loong time is that shred is overwriting every bit of the original file and then rewriting with zeros.

A single overwrite will do everything you need (unless you have a specific regulatory requirement for multiple overwrites) so checking the file size then copying a file of at least that to each one will overwrite the whole file.

If you are just needing to 'delete' the file in *nix, just delete the inodes, and in Windows just delete and empty the recycle bin, however both these mechanisms will allow forensic tools to retrieve the majority of the data. The same will happen if you just overwrite with a small file.

Have a read of this question over on Security Stack Exchange and our wider associated blog post

3
  • I am using -n 1 so only a single overwrite is done. May 2, 2012 at 8:15
  • Oh - of course. In which case the issue is that you are covering the entire file. But you need to do that if you want to delete the data as even if you remove the header it is straightforward to retrieve the rest of the file
    – Rory Alsop
    May 2, 2012 at 8:25
  • You are right, my idea of removing only headers was a bad idea. May 2, 2012 at 8:26

You must log in to answer this question.

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