Less known Solaris Features: CacheFS - Part 5: On-demand consistency checking
Let´s assume you share a filesystem with static content (for example the copy of a cdrom) or a filesystem that changes on a regular schedule (for example at midnight every day). So it would pose unnessesary load to network to check the consistency everytime again.
CacheFS knows a special mode of operation for such an situation. It´s called on demand consistency checking. It does exactly what the name says: It checks only the consistency of files in the cache, when you tell the system to do it.
I will demonstrate this with an example:
With normal consistency check
Let´s assume, we stay with the normal mode of operation from the example before. We create a file on the fileserver.
When we go to the NFS client and access the directory, this new file is visibile instantaneous. And when we access it, we see the content of the file.
Now we go back to the server, and append additional data to the file:
And obviously, you will see this change on the client:
With on-demand consistency check
Now we unmount it, and remount it:
You may have noticed the demandconst
option. This option changes everything.Let´s assume you created another file on the NFS server:
Back on the NFS client you will not even see this file:
You have to trigger a consistency check. This is quite easy.
Now you can see the file in the directory.
Okay, now we can look into the file.
Now we append a new line to the file on the server by executing the following commands on the NFS server
When we check this file on our NFS client, we still see the cached version.
So let´s trigger a consistency check:
Now we can look into the file again, and you will see the new version of the file.
Okay, it´s pretty obvious this isn´t a feature for a filesystem that change in a constant and fast manner. But it´s really useful for situations, where you have control over the changes. As long as a file is cached, the file server will see not a single access for such files. Thus such a file access doesn´t add to the load of the server. There is an important fact here: It doesn´t tell CacheFS to check the files right at that moment. It just tells CacheFS to check it at the next access to the file. So you don´t have an consistency check storm.