A computer components & hardware forum. HardwareBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » HardwareBanter forum » General Hardware & Peripherals » Storage & Hardrives
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Can I flush the disk cache?



 
 
Thread Tools Display Modes
  #1  
Old January 23rd 08, 01:37 PM posted to comp.arch.storage
mike
external usenet poster
 
Posts: 121
Default Can I flush the disk cache?

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!
  #2  
Old January 23rd 08, 04:41 PM posted to comp.arch.storage
Cydrome Leader
external usenet poster
 
Posts: 113
Default Can I flush the disk cache?

mike wrote:
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


does disabling write cache under device properties for the disk under
windows help at all? There may also be options (this could be for XP only
though) to optimize removable media for "speed" or for "fast removal". Try
the fast removal option if it's there.
  #3  
Old January 24th 08, 03:57 AM posted to comp.arch.storage
mike
external usenet poster
 
Posts: 121
Default Can I flush the disk cache?

Cydrome Leader wrote:
mike wrote:
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


does disabling write cache under device properties for the disk under
windows help at all? There may also be options (this could be for XP only
though) to optimize removable media for "speed" or for "fast removal". Try
the fast removal option if it's there.


That's the default setting. Write caching should be for writes.
My problem is with reads.
--
Return address is VALID!
  #4  
Old January 24th 08, 04:52 AM posted to comp.arch.storage
Maxim S. Shatskih
external usenet poster
 
Posts: 87
Default Can I flush the disk cache?

Or maybe unmount/remount the usb drive?

Yes.

You need not flush but purge, and cache purges in Windows is only done by
remount.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation

http://www.storagecraft.com

  #5  
Old January 24th 08, 04:53 AM posted to comp.arch.storage
Maxim S. Shatskih
external usenet poster
 
Posts: 87
Default Can I flush the disk cache?

does disabling write cache under device properties for the disk under
windows help at all?


This will not disable the cache completely, especially for reads.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation

http://www.storagecraft.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cartridge flush liquid Roy Printers 2 September 15th 05 11:43 AM
Does mountvol flush the buffer cache? Joerg Lenneis Storage & Hardrives 3 November 29th 04 10:24 PM
Disabling disk cache? Nuno Magalhaes Storage & Hardrives 8 October 30th 03 10:31 PM
Disabling disk cache? Nuno Magalhaes Storage (alternative) 3 October 27th 03 04:21 AM
Disabling disk cache? Nuno Magalhaes General 2 October 27th 03 12:08 AM


All times are GMT +1. The time now is 10:07 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 HardwareBanter.
The comments are property of their posters.