3

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?

Nicolas Raoul
  • 11,561

2 Answers2

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...

Cylindric
  • 733
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

Rory Alsop
  • 3,360