[ Team LiB ] |
![]() ![]() |
Cache File SystemsYou can use CacheFS to improve NFS server performance and scalability by reducing server and network load. CacheFS is designed as a layered file system that enables the system to cache one file system on another. In an NFS environment, CacheFS enables you to have more NFS clients for each NFS server because each client can cache NFS information, thus reducing the load on the NFS server. CacheFS improves performance for clients on slow links such as Point-to-Point Protocol (PPP). Understanding CacheFSWith CacheFS you can enable a client system to cache a file system from a server. Initial access to the file system may seem slow, but subsequent uses of the same file by the user are faster. Typically, you would cache an NFS or HSFS file system. You create cache file systems individually on each client system that needs improved NFS performance.
NOTE. CacheFS does not support caching of the root (/) and /usr file systems.
After you have completed the setup of the CacheFS, files are dynamically placed in the cache as the user accesses them.
NOTE. You can mount only file systems that are shared from the server in question. Refer to the share (1M) manual page for more information or see "Sharing Files from a Server" on page 207. Creating a CacheUse the following steps on a client system to create a cache.
In the following example, a cache directory named cachefile is created in the /local directory. oak% su # cfsadmin -c /local/cachedir # Specifying a File System to Be Mounted in the CacheYou can specify file systems to be mounted through the cache so that users can locally access files in the cache file system you create. You can specify the file systems to be cached in three ways.
Creating a Mount PointRegardless of the mechanism you choose to mount the file system, you need to create a mount point on the client system where CacheFS mounts the files. The mounted files are then cached in the cache directory that you created. Type mkdir mount-point and press Return. In the following example, a mount point named /cachemount is created.
# mkdir /cachemount
#
Specifying a File System (mount)You provide the following parameters for the mount command.
Use the following steps to mount a cache file system from a command line.
The following example creates a cache directory named /local/cachedir, creates a mount point named /usr/local, and mounts the NFS file system castle:/export/local as a cached file system named /usr/local in the cache named /local/cachedir. paperbark% su Password: # mkdir /usr/local # mkdir /local # cfsadmin -c /local/cachedir # mount -F cachefs -o backfstype=nfs,cachedir=/local/cachedir castle:/export/local /usr/local # cachefsstat /usr/local /usr/local cache hit rate: 100% (0 hits, 0 misses) consistency checks: 0 (0 pass, 0 fail) modifies: 0 garbage collection: 0 # If the file system was not mounted in the cache, an error message similar to the following is displayed.
# cachefsstat /local
cachefsstat: /local not a cachefs mountpoint
#
Specifying a File System (/etc/vfstab File)When you add a cache file system to the /etc/vfstab file on the client system, the back file system remains available to users as a cached file system. When you have created the cache directory and the mount point, use the following steps to mount a cache file system from the /etc/vfstab file.
castle:/export/local /local/cachedir /usr/local 7 yes local-access,bg,nosuid,demandconst,backfstype=nfs,cachedir=/usr/local Specifying a File System (Automounter Map)You add a cache file system to the auto_direct automounter map by specifying the -fstype=cachefs option to mount. Note that you also specify the CacheFS mount options (for example, backfstype and cachedir). Refer to the automount(1M) manual page for more information about automount maps or to the Solaris Advanced System Administrator's Guide, available from Sun Microsystems Press. Use the following steps to specify a cache file system in the automounter map.
Maintaining CachesAfter you set up cache file systems, you can perform the following maintenance tasks on them.
If you are using the /etc/vfstab file to mount file systems, you modify the cache by editing the file system options in the /etc/vfstab file. If you are using the automounter, you modify the cache by editing the file system options in the automounter maps. Table 52 lists the commands that you can use to perform cache maintenance. Refer to the appropriate manual page for more details.
![]() |
[ Team LiB ] |
![]() ![]() |