Can I flush the disk cache?
- From: mike <spamme9@xxxxxxxxx>
- Date: Wed, 23 Jan 2008 12:37:54 GMT
I'm trying to detect data corruption on a usb hard drive.
My test program writes then reads the disk, but never finds
any corruption. But if I unmount/unplug and replug the usb, the
corruption appears.
It occurs that Windows 2k/xp has cached the small files.
Since the changes didn't come thru the OS, the OS thinks the
data is good and just hands me what's in the cache from the previous
read.
I'm trying to do this with simple VB6 (legacy) code:
Open filenamestring For Input As #1
inputstring = Input(14, #1)
Close #1
to keep it simple.
Is there a way to force the OS to flush the disk buffers/cache and give
me what's actually on the disk the next time I open the file?
Or maybe unmount/remount the usb drive?
Or do I need a more complicated file handler?
Or maybe I'm barking up the wrong tree??? Better tree?
I've googled for cache, flush, buffer and unbuffered and every
combination I can think of. Nothing useful found.
Thanks, mike
--
Return address is VALID!
.
- Follow-Ups:
- Re: Can I flush the disk cache?
- From: Maxim S. Shatskih
- Re: Can I flush the disk cache?
- From: Cydrome Leader
- Re: Can I flush the disk cache?
- Prev by Date: Re: Utility to write huge files instantly???
- Next by Date: Re: Linux LVM software raid, and SAN question.
- Previous by thread: Linux LVM software raid, and SAN question.
- Next by thread: Re: Can I flush the disk cache?
- Index(es):
Relevant Pages
|