How do I force a read from disk?

I’m trying to run a new RAID through its paces by writing then reading a bunch of large files. It seems that the read-after-write is from the file cached in RAM, rather than from the RAID itself (Activity monitor reports no big data reads during the read phase). I change the files mod date between the write and read phases to fool the OS into thinking the cache must be stale, but I still don’t see a big disk read activity.
How can I ensure that I am reading back data from the disk (RAID) and not from the RAM cache?

P.

Are you closing the files between the write/read cycles?

And you know that there are utilities out there that do this, right?

[quote=38120:@Peter Stys]I’m trying to run a new RAID through its paces by writing then reading a bunch of large files. It seems that the read-after-write is from the file cached in RAM, rather than from the RAID itself (Activity monitor reports no big data reads during the read phase). I change the files mod date between the write and read phases to fool the OS into thinking the cache must be stale, but I still don’t see a big disk read activity.
How can I ensure that I am reading back data from the disk (RAID) and not from the RAM cache?

P.[/quote]

to force read/writes (aka IOs) to the physical spindles of a RAID controller is to overrun the cache on the controllers or have a way to turn the cache off. When your hosts “forces a write” to disk, the RAID controller intercepts it in its cache and acknowledges the write to the disk although it is still in cache. Then it writes the IO to the physical disk(s) when it has time or it is forced out of cache.

believe it or not there is several (potential) layers of caching too. the O/S caches read/writes before actually writing to the “disks”. And if you have a RAID controller that is another layer of cache. And most disks these days have a cache on the controller board to buffer the read/writes.

I deal with this all day long so I can answer any questions you have on the subject.

[quote=38122:@Kem Tekinay]Are you closing the files between the write/read cycles?

And you know that there are utilities out there that do this, right?[/quote]

yes, i sure do close the stream.

I’m sure there are utilities. I am notorious for re-inventing the wheel (gives me a reason to write code). Any good and free ones you can recommend?

P.

The safest way is probably to unmount the volume. That should surely dispose of any caches. You can even accomplish that with an Applescript.

Forcing a read from disk kind of subverts the whole reason you want a raid with lots of cache
You should be testing various disaster modes like write / fail then bring it back up & read and is the data written safely and correctly

thx, it’s never easy is it? I just want to burn that RAID in to make sure it saves file reliably…

Actually, I just figured out a very easy way: I write a 50GB file. Exceeds any possible caches, and now the RAID is hit on for both R/W.

That’s funny, I was going to suggest something like that, but was going to recommend making it a number of large files in an array, then start reading the files from first to last. If you fill the RAID, it can’t possibly cache it all.