Re: Is there a way to flush the file cache?
- From: "Tony Lawrence" <pcunix@xxxxxxxxx>
- Date: 29 Dec 2006 03:59:38 -0800
Tony Lawrence wrote:
zentara@xxxxxxxxxxxxxx wrote:
On 28 Dec 2006 21:56:41 GMT, General Schvantzkoph
<schvantzkoph@xxxxxxxxx> wrote:
What I want to do is the following,
1) Create a file and write it to the disk.
2) Read that file off of the disk and then check it.
I'm trying to check the SATA interfaces so it's important that the file go
to and from the disks. The file cache interferes with this because if the
file is present in the cache the program will get the cached copy not the
copy that is on the disk. The sync() call forces the disk writes to happen
immediately which is half of the battle. The other half is to purge the
file cache so that all subsequent file reads come from the disk. Is there
a way to do this?
Dosn't the 'sync' command do this?
Maybe. In traditional Unix, sync is a REQUEST to the kernel to flush
data. That the data is actually written right then is almost always
reasonable to assume, but isn't something you'd put your life on the
line over.
And we can't forget that almost all disk drives have some caching
themselves, even if only momentary. I just did a quick Google and it
looks like most SATA drives have 8-16 MB of cache.
Back to my original reaction: any given app might implement its own
cache, either through STDIO or its own buffers, and "sync" doesn't help
you there.
I have to assume that the reason for this question has something to do
with data integrity: the op wants to be certain data is safely stored
on magnetic media. Given all the places the data could be until it
gets there, I'd say a UPS is mandatory.
--
.
- References:
- Is there a way to flush the file cache?
- From: General Schvantzkoph
- Re: Is there a way to flush the file cache?
- From: Tony Lawrence
- Re: Is there a way to flush the file cache?
- From: General Schvantzkoph
- Re: Is there a way to flush the file cache?
- From: zentara
- Re: Is there a way to flush the file cache?
- From: Tony Lawrence
- Is there a way to flush the file cache?
- Prev by Date: Re: Is there a way to flush the file cache?
- Next by Date: Re: Is there a way to flush the file cache?
- Previous by thread: Re: Is there a way to flush the file cache?
- Next by thread: Re: Is there a way to flush the file cache?
- Index(es):
Relevant Pages
|