I there a utility like ntfswipe for ext3 filesystems?
See the "badblocks" command.
badblocks -w -t 0 /dev/sdny
where n = the physical disk a, b, c, ...,z
and y = the partition number 0, 1, 2, 3, ..., n
Be very sure you are pointing at the correct partition because this command effectively writes binary 0's (-t 0) to the targeted partition.
You can add another parameter:
-p n (where n > 0) and it controls the number of passes on the target partition.
badblocks -w -p 3 -t 0 /dev/sda2
...will run 4 passes (0, 1, 2, 3) on the second partition of the sda drive and effectively write/read 0's to the entire partition on each pass. Know what you are doing because this command will erase active partitions if you happen to point at the wrong one and hit the Enter key.
Thanks, but this is not what I'm looking for. I'd like to set each unused block to 0 (or better: each unused byte), but the existing data should be preserved.
Sorry, I thought you wanted to clear the entire partition.
Stupid question, why would you want to only clear unallocated space? Just curious.
When I delete files, usually only the inode is removed. I'd like to ensure that all data that is no longer accessible from ordinary file access can't be recovered by raw disk access. (I know there is the s flag, but according to the manpage, it's not implemented in mainline kernel, and if I forget to set it, it does not help afterwards.)
There is a tool that does what you want here:
I've not tried it myself, and I can see some changes that I would make to speed it up (by zero'ing multiple blocks at a time) and to make it safer (to add resize2fs's enforcement that the filesystem be freshly fsck'ed), but it seems to do what you want.
As always do a backup first; look through the code and be comfortable you understand what you're doing, and remember, as with any free or open source code which you download off the network, it comes with no warantees or guarantees. If it breaks your systems, you get to keep both pieces....
(something that zero's blocks on disk, if it screws up and gets the wrong blocks, can do a lot of damage!)
Thanks for this link. I just found a tool that is more similar to ntfswipe: