开发者

Permanently removing files from hard drive

I am wondering how to go about writing a program to permanently remove files from my hard drive. I know that my program needs to at least have the same functionality as "rm" in terms of removing the system's links to the data, but I also am interested in how I go about nullifying (entirely) the data on the disk.

I am pretty sure that C and assembly will provide this low level functionality, but 开发者_如何转开发I'm not really sure how to even start trying to access parts of the disk, or track down the locations of different fragments of a file on the disk.

I know this might seem like kind of a big project due to my lack of knowledge on filesystems, but I'm just trying to learn. I'm aware that I'll need to learn more about hard drives and what type of drive I'm specifically trying to work with. But any help/links you could provide would be appreciated.


I think what you want is to use a program like scrub. The only problem, is that for many file system it does not work.

To come up with a generic solution is probably going to be impossible.


It is okay if you open the file, get the file size and then write n null bytes to the file that you want to delete (where n is the number of bytes).

Afterwards just delete the file. All data will be lost and if someone recovers the file-node all he can see is a bunch of zeroes.

That said: I'm sure that some people here will tell you that you have to wipe the file with zeros (or some other pattern) at least 10 to 15 times to really remove all traces of the content. erase the file once for ever.

This is an urban legend. Don't trust them. Noone, not even the guys from the CSI tv-series can recover a file that has been wiped once.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜