Erasing files on cached HDD's

A

Anonymous

Guest
Now every Drive has a internal write and read file cache (up to 16MB, and maybe more). I think if I want to read and/or write a file the hdd first caches this file. So, what if I want to erase this file which is cached directly on the harddrive? I think thats a problem. Every pass during the overwrite procedure doesn't write direcly to the magnetic media and the entire number of passes even if gutmann is used is only ONE!!! Every write access (overwrite pass) is done not on the magnetic media, but on the cache. After the last pass the file is closed and written back from the hdd-cache to the magnetic storage, because an other file becomes cached.

Does, and how does Eraser handle this caching problem?
How can this problem be handled?

As long as I know the solution isn't achieved through:
// flush to disk
FlushFileBuffers(hFile);
or through:
CreateFile(...) flags: FILE_FLAG_WRITE_THROUGH|FILE_FLAG_NO_BUFFERING,

Story behind:
I tried to erase some files and got a throughput of 170 megs/second thats impossible. My drive can't write more than about 30 megs/s. But the cache on the drive is 8MB.
 
Disk Cache is a temporary storage area in RAM for data being read from or written to a hard drive, and is used to speed up access time to the drive. The process of disk caching works like this:

1.) The CPU asks for data from the hard drive.

2.) The hard drive controller sends instructions to the drive to read the data and then sends the data to the CPU.

3.) The CPU requests more data, quite often data that immediately follows the previously read data on the hard drive.

4.) The controller reads the requested data from the drive and sends it back to the CPU. Without a cache, each CPU request requires that data be read from the hard drive.

Does this explain to you that your data that is in your Disk Cache is not needing to be overwritten? (Because it is in RAM and is gone when you reboot or shutdown your PC.)
 
Wait, so that means the disk cache dosen't really exist? that its jus all in the ram? i thought it was stored on the hard drive controller somewhere in a chip:S or something:S.lol. So why do hard drives have different ratings like 8mb and 16mb? Also can there be remenents of files in anything apart from the platters?

Thx!
 
i think sonic is right !

when you are wiping a file , the data is stored in the cache memory of hard drive , and then , when the 35 passes are done(in the cache memory ) , the cache is transferred to the magnetic surface . ( for little files like files inferiro to 8 or 16 MB) .then there is really one pass in the magnetic surface ( and not 35)
 
If thats right, thats a BIG problem due to the wiping security!

I can't explain to myself why I got such a high throughput. If the data is cached for reading that doesn't affect the writing process to the disk. Because overwriting during erasing files is done without reading the file. So how can I get a writing speed of 170 MB/s?

My worry is that the actual file which should be erased is held in cache as long as the overwriting process takes place. The drive can't write 170 MB/s, so some overwirting passes won't be written to the drive. After the last pass of the overwriting process the file is written back to disk. Maybe somewhen within the overwriting process the file is written back too. But I mean again that the drive can't write the whole 170MB/s.
We are talking about less than milliseconds of time the file is held in cache - if then the power is lost - the file on the disk may be the original one...

Is there a way to turn off the writing cache while I'm erasing a file?
Are there some functions in MS VC++, which garant a direct drive access?

As I mentiont befor the solution isn't achieved through:
// flush to disk
FlushFileBuffers(hFile);
or through:
CreateFile(...) flags: FILE_FLAG_WRITE_THROUGH|FILE_FLAG_NO_BUFFERING,

But maybe there is another function. But I don't think so.
 
I tested erasing files on many drives. I just found a not that old drive (about 1,5 years, 60GB, 8MB Cache) where the disk cache isn't working anymore. I compared erasing 420 small files (average size is 5,3kB) on that drive and on a similar drive (only difference is that the cache is working). The result is on the not cached drive erasing takes 479s, on the cached drive 24s!
So that result confirms my assumption that the disk cache is a BIG problem.
 
this confirm what i said

-file is wiped in hard drive cache memory (35 passes) (for files <=8 or 16MB)
-and then the result of the last recording is writed on magnetic surface

total 1 pass


there is a really big problem for small files!!!!
 
Here is more information from Western Digital:

http://www.westerndigital.com/en/company/glossary.asp

Cache — High-speed RAM used as a buffer between the CPU and a hard drive. The cache retains recently accessed information to speed up subsequent accesses to the same data. When data is read from or written to disk, a copy is saved in the cache, along with the associated disk address. The cache monitors the addresses of subsequent read operations to see if the required data is already in the cache. If it is, the drive returns the data immediately. If it is not in the cache, then it is fetched from the disk and saved in the cache.
 
Back
Top