File with same number of bytes saved on same location on hard drive?

  • Thread starter Thread starter name
  • Start date Start date
N

name

Hello. I want to overwrite a file's old contents on the hard drive
(an NTFS partition), and was wondering if anyone knows for sure
whether this would work: open the file, change every byte to some
random value, and save the file. I'm not sure, will it be saved on
the same location on the hard drive, over the old one on disk? (I
realize there are utilities for doing file wiping, but I need this for
a bit more.)
 
Hello. I want to overwrite a file's old contents on the hard drive
(an NTFS partition), and was wondering if anyone knows for sure
whether this would work: open the file, change every byte to some
random value, and save the file. I'm not sure, will it be saved on
the same location on the hard drive, over the old one on disk? (I
realize there are utilities for doing file wiping, but I need this for
a bit more.)

Actually, what you describe is the way security wipe software works.

Just one comment: Don't overwrite the entire file in a single step, you may
have a memory shortage on large files, use successive block writes instead,
until you hit the EOF (or file size). ;-)

Regards, Zvi
 
Previously name said:
Hello. I want to overwrite a file's old contents on the hard drive
(an NTFS partition), and was wondering if anyone knows for sure
whether this would work: open the file, change every byte to some
random value, and save the file. I'm not sure, will it be saved on
the same location on the hard drive, over the old one on disk? (I
realize there are utilities for doing file wiping, but I need this for
a bit more.)

This works, unless you have a journalling filesystem or a filesystem
that does fragments (use not filled end-blocks for several files).
I am not aware of any filesystem that does this fragment usage,
although it was planned for ext2 at some time if I remember correctly.

In a journalling filesystem the original blocks will still be
overwritten, but there may be stuff in the journal that will not be
overwritten. NTFS is not journalling.

One thing you need to make sure of is that the blocks are flushed
to disk _before_ you delete the file (if you do). Otherwiese
the OS buffer-cache might see the deletion before it writes
the blocks to disk and just cancel the operation. The HDD
buffer is no problem here, since the HDD is not aware of the
filesystem. The HDD buffer may have an impact if you do
multiple overwrites.

Arno
 
Folkert Rienstra said:
Probably not. I wouldn't trust it one bit if it did.

Does your assertion stem from positive knowledge that it doesn't work that way,
or lack of? How do you think it should work so that you can trust it? ;)

Regards
 
Zvi Netiv said:
Does your assertion stem from positive knowledge that it doesn't work that way,

Was that a question?
or lack of?

What does 'Probably not' sound like to you?
How do you think it should work so that you can trust it? ;)

I expect 'security wipe software' to erase a full drive on the physical level.
A security delete software like Incinerate -and what have you- on the other hand
that add a secure bin or replace the recycle bin may work like explained above.
 
Back
Top