Re: deleting files with linux
From: Chris Lowth (email@example.com)
From: Chris Lowth <firstname.lastname@example.org> Date: Tue, 22 Apr 2003 14:59:15 +0100
> On Mon, 21 Apr 2003, G. Wolfe Woodbury wrote:
>> The "standard" Linux filesystem (ext2/ext3) remove files by removing the
>> pointer to the 'i-node' in the directory file. The i-node is then
>> released for re-use, and the disk blocks in use by the inode are added
>> back to the list of free blocks.
Not quite true .. "rm" decrements a "reference count" (the number of "links"
to the inode). The node and it's space are only freed when..
- the reference count drops to zero (ie: no more links)
and - the file is closed by any processes that have openned it.
and - the file system "syncs" it's buffers
>> ls -l <filename> #to get the length of the file
>> dd if=/dev/zero of=<filename> count=<length> #to write zero's
>> dd if=/dev/urandom of=<filename> count=<length> #to write random data
>> bytes rm <filename>
Nope - wont work (well - may not work) because dd truncates and re-allocates
the file space, which can wind up moving it (or bits of it).
Keep it simple - use the "shred" utility which is specifically designed to
do what the OP is after (ie: "in-place" zapping of the file).
-- My real address is: chris at lowth dot sea oh em -> OpenSource e-mail virus protection : http://protector.sourceforge.net -> iptables configuration wizards : http://www.lowth.com/LinWiz