I had read that the shred doesn't safely work for compressed filesystems when shredding a file, how this can be accomplished in a compressed fs ?

  • Where did you read that? – soandos Aug 29 '11 at 17:23
  • @soandos: linux.about.com/library/cmd/blcmdl1_shred.htm -> "The following are examples of filesystems on which shred is not effective: ... compressed filesystems " – woliveirajr Aug 29 '11 at 17:46
  • >CAUTION: Note that shred relies on a very important assumption: that the filesystem overwrites data in place. This is the traditional way to do things, but many modern filesystem designs do not satisfy this assumption. is the key part of that article. – soandos Aug 29 '11 at 17:56

Shred will overwrite the file by reading and writing it with new information (random data).

Each time it is rewritten, the fylesystem will have to deal with uncompressing it, getting the bytes from shred, compressing them and finally writing them back to the fylesystem.

Edit: the shred manpage have some information about compressed filesystem.

The problem with some compressed filesystems is the same as other filesystems: shred can't guarantee that the filesystem will write the "new" data exactly over the previous data. When that happens, small pieces of the "original" content might be left somewhere else in the drive. This problem can happen, for example, even in flash drives, where the leverage function will try to not keep overwriting the same place.

Solution: one simple, general-purpose solution: I assume that the compressed filesystem (FS, from now on) is permanent inside a partition, i.e., it's not a FS-inside-a-file-in-a-regular-FS. That way, the FS will always be inside a partition.

1st: delete your file, shred it, do whatever you want.

2nd: create a big, huge file that will leave your FS without empty space. This way, you'll be sure that all space was overwritten. Delete it. Create another file. Delete it. Create... and do that as many times you think you'll need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.