This chapter describes how to set up and maintain CacheFSTM file systems.
This is a list of task maps in this chapter.
For information on troubleshooting CacheFS errors, see Troubleshooting cachefspack Errors.
For important information about NFS version 4 and the CacheFS software, see NFS Version 4 and CacheFS Compatibility Issues.
Use this task map to identify all the tasks for using CacheFS file systems. Each task points to a series of additional tasks such as creating and mounting CacheFS file systems, and packing and maintaining the cache.
Task |
Description |
For Instructions |
---|---|---|
1. Create and mount a CacheFS file system. |
Create the cache and mount the file system in the cache. | |
2. Maintain a CacheFS file system. |
Display and modify a CacheFS file system by unmounting, removing, or re-creating the cache. | |
3. (Optional) Pack and unpack a CacheFS file system. |
Determine whether you want to pack the cache and use packing lists. Packing the cache ensures that certain files and directories are always updated in the cache. | |
4. Collect CacheFS statistics. |
Determine cache performance and appropriate cache size. |
The CacheFS file system is a general purpose caching mechanism that improves NFS server performance and scalability by reducing server and network load. Designed as a layered file system, the CacheFS file system provides the ability to cache one file system on another file system. In an NFS environment, the CacheFS file system increases the client per server ratio, reduces server and network loads, and improves performance for clients on slow links, such as Point-to-Point Protocol (PPP).
You create a CacheFS file system on a client system so that file systems you cache can be accessed by the client locally instead of across the network. The following figure shows the relationship of the components that are involved in using CacheFS file systems.
The back file system is the file system that you specify to be mounted in the cache. A back file system can be either NFS or HSFS (High Sierra File System). When the user attempts to access files that are part of the back file system, those files are placed in the cache. The front file system is the file system that is mounted in the cache and is accessed from the local mount point. The front file system type must be UFS.
To the user, the initial request to access a file in a CacheFS file system might seem slow. However, subsequent uses of the same file are faster.
Each cache has a set of parameters that determines the cache structure and how it behaves. The parameters are set to the default values listed in the following table. The default values specify that the entire front file system is used for caching, which is the recommended method of caching file systems.
Table 20–1 CacheFS File System Parameters and Their Default Values
CacheFS File System Parameter |
Default Value |
Definition |
---|---|---|
maxblocks |
90 % |
Sets the maximum number of blocks that a CacheFS file system is allowed to claim within the front file system. |
minblocks |
0 % |
Sets the minimum number of blocks that a CacheFS file system is allowed to claim within the front file system. |
threshblocks |
85 % |
Sets the number of blocks that must be available in the front file system before a CacheFS file system can claim more than the blocks specified by minblocks. |
maxfiles |
90 % |
Sets the maximum number of available inodes (number of files) that a CacheFS file system is allowed to claim within the front file system. |
minfiles |
0 % |
Sets the minimum number of available inodes that a CacheFS file system is allowed to claim within the front file system. |
threshfiles |
85 % |
Sets the number of inodes that must be available in the front file system before a CacheFS file system can claim more files than is specified in minfiles. |
Typically, you should not change any of these parameter values. They are set to default values to achieve optimal cache behavior. However, you might want to modify the maxblocks and maxfiles values if you have some room in the front file system that is not used by the cache, and you want to use it for some other file system. You do so by using the cfsadmin command. For example:
$ cfsadmin -o maxblocks=60 |
Use the procedures in this task map to create and mount a CacheFS file system.
Task |
Description |
For Instructions |
---|---|---|
1. Share the file system to be cached. |
Verify that the file system you want to cache is shared. | |
2. Create the cache. |
Use the cfsadmin command to create the cache. | |
3. Mount a file system in the cache. |
Mount a file system in a cache by using one of the following methods: |
|
|
Mount a CacheFS file system by using the mount command. | |
|
Mount a CacheFS file system by editing the /etc/vfstab file. | |
|
Mount a cached file system by using AutoFS. |
Become superuser on the client system.
# cfsadmin -c /cache-directory |
where cache-directory indicates the name of the directory where the cache resides.
For more information, see cfsadmin(1M).
After you have created the cache, do not perform any operations within the cache directory itself. Doing so could cause conflicts within the CacheFS software.
The following example shows how to create a cache in the /local/mycache directory by using the default cache parameter values.
# mkdir /local # cfsadmin -c /local/mycache |
You specify a file system to be mounted in the cache so that users can locally access files in that file system. The files do not actually get placed in the cache until the user accesses the files.
The following table describes three ways to mount a CacheFS file system.
Mount Type for CacheFS File System |
Frequency of CacheFS Mount Type |
---|---|
Using the mount command |
Every time the system reboots in order to access the same file system. |
Editing the /etc/vfstab file |
Only once. The /etc/vfstab file remains unchanged after the system reboots. |
Using AutoFS |
Only once. AutoFS maps remain unchanged after the system reboots. |
Choose the method of mounting file systems that best suits your environment.
You can mount only file systems that are shared. For information on sharing file systems, see share(1M).
The caching of the root (/) and /usr file systems is not supported in a CacheFS file system.
Become superuser on the client system.
Create the mount point, if necessary.
# mkdir /mount-point |
You can create the mount point from anywhere, but it must be a UFS file system. The CacheFS options used with the mount command, as shown in the next step, determine that the mount point you create is cached in the cache directory you specify.
Mount a file system in the cache.
# mount -F cachefs -o backfstype=fstype,cachedir=/cache-directory[,options] /back-filesystem /mount-point |
Indicates the file system type of the back file system, which can be either NFS or HSFS.
Indicates the name of the UFS directory where the cache resides. This name is the same name you specified when you created the cache in How to Create the Cache.
Specifies other mount options that you can include when you mount a file system in a cache. For a list of CacheFS mount options, see mount_cachefs(1M).
Specifies the mount point of the back file system to cache. If the back file system is an NFS file system, you must specify the host name of the server from which you are mounting the file system and the name of the file system to cache, separated by a colon. For example, merlin: /data/abc.
Indicates the directory where the file system is mounted.
Verify that the cache you created was actually mounted.
# cachefsstat /mount-point |
The /mount-point is the CacheFS file system that you created.
For example:
# cachefsstat /docs /docs cache hit rate: 100% (0 hits, 0 misses) consistency checks: 1 (1 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 /mount-point cachefsstat: mount-point: not a cachefs mountpoint |
For more information about the cachefsstat command, see Collecting CacheFS Statistics.
The following example shows how to mount the NFS file system merlin:/docs as a CacheFS file system named /docs in the cache named /local/mycache.
# mkdir /docs # mount -F cachefs -o backfstype=nfs,cachedir=/local/mycache merlin:/docs /docs |
The following example shows how to make a Solaris 9 SPARC® CD (HSFS file system) available as a CacheFS file system named /cfssrc. Because you cannot write to the CD, the ro argument is specified to make the CacheFS file system read-only. This example assumes that the removable media services are not running.
# mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /sol9 # mount -F cachefs -o backfstype=hsfs,cachedir=/cfs/cache,ro,noconst, backpath=/sol9 /dev/dsk/c0t6d0s0 /cfssrc # ls /cfssrc Copyright Solaris_9 |
The following example shows how to mount a Solaris 9 SPARC CD as a CacheFS file system with vold running.
# mount -F cachefs -o backfstype=hsfs,cachedir=/cfs/cache,ro,noconst, backpath=/cdrom/sol_9_sparc/s0 /vol/dev/dsk/c0t2d0/sol_9_sparc/s0 /cfssrc |
The following example shows how to mount a CD as a CacheFS file system with vold running.
# mount -F cachefs -o backfstype=hsfs,cachedir=/cfs/cache,ro,noconst, backpath=/cdrom/epson /vol/dev/dsk/c0t2d0/epson /drvrs |
The following example uses the demandconst option to specify consistency checking on demand for the NFS CacheFS file system /docs, whose back file system is merlin:/docs. For more information, see Consistency Checking of a CacheFS File System.
# mount -F cachefs -o backfstype=nfs,cachedir=/local/mycache,demandconst merlin:/docs /docs |
Become superuser on the client system.
Using an editor, specify the file systems to be mounted in the /etc/vfstab file.
See the example that follows.
For more information on the /etc/vfstab file, see Field Descriptions for the /etc/vfstab File.
Mount the CacheFS file system.
# mount /mount-point |
Or, reboot the system.
The following example shows the /etc/vfstab entry for the /data/abc directory from the remote system starbug that is mounted in the cached directory, /opt/cache.
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # starbug:/data/abc /local/abc /opt/cache cachefs 7 yes local-access,bg, nosuid,demandconst,backfstype=nfs,cachedir=/opt/cache |
You can mount a file system in a cache with AutoFS by specifying the -fstype=cachefs mount option in your automount map. Note that the CacheFS mount options, for example, backfstype and cachedir, are also specified in the automount map.
For details on automount maps, see Task Overview for Autofs Administration in System Administration Guide: Network Services or automount(1M).
Become superuser on the client system.
Using an editor, add the following line to the auto_direct map:
/mount-point -fstype=cachefs,cachedir=/directory,backfstype=nfs server:/file-system |
Using an editor, add the following line to the auto_master map:
/- |
The /- entry is a pointer to check the auto_direct map.
Reboot the system.
Verify that the entry was made correctly by changing to the file system you mounted in the cache, and then list the contents.
# cd /filesystem # ls |
The following auto_direct entry automatically mounts the CacheFS file system in the /docs directory.
/docs -fstype=cachefs,cachedir=/local/mycache,backfstype=nfs merlin:/docs |
After a CacheFS file system is set up, it requires little maintenance. Use the optional procedures in this task map if you need to perform maintenance tasks on your CacheFS file systems.
Task |
Description |
For Instructions |
---|---|---|
Modify a CacheFS file system. |
Modify CacheFS file system behavior by unmounting, deleting, or re-creating the cache. | |
Display CacheFS file system information. |
Display information about CacheFS file systems by using the cfsadmin command. | |
Perform consistency checking. |
Perform consistency checking on demand by using the cfsadmin command. | |
Delete a CacheFS file system. |
Delete a CacheFS file system by using the umount command and the cfsadmin command. | |
Check the integrity of a CacheFS file system. |
Check the integrity of a CacheFS file system by using the fsck_cachefs command. |
This section describes how to maintain a CacheFS file system.
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 AutoFS, you modify the cache by editing the file system options in the AutoFS maps.
When you modify a file system in the cache, you need to delete the cache and then re-create it. You might also need to reboot your machine in single-user mode, depending on how your file systems are shared and accessed.
In the following example, the cache is deleted, re-created, and then mounted again by using demandconst option specified for the /docs file system.
# shutdown -g30 -y . . . Root password for system maintenance (control-d to bypass): single-user privilege assigned to /dev/console. . . . Here is where you might be prompted to run fsck on the file system where the cache is located. # fsck /local # mount /local # cfsadmin -d all /local/mycache # cfsadmin -c /local/mycache # init 6 . . . console login: password: # mount -F cachefs -o backfstype=nfs,cachedir=/local/cache1,demandconst merlin:/docs /docs # |
Become superuser on the client system.
Display information about all file systems cached under a specified cache.
# cfsadmin -l /cache-directory |
where /cache-directory is the name of the directory where the cache resides.
The following example shows information about the /local/mycache cache directory. In this example, the /docs file system is cached in /local/mycache. The last line displays the name of the CacheFS file system.
# cfsadmin -l /local/mycache cfsadmin: list cache FS information maxblocks 90% minblocks 0% threshblocks 85% maxfiles 90% minfiles 0% threshfiles 85% maxfilesize 3MB merlin:_docs:_docs # |
To ensure that the cached directories and files remain current, the CacheFS software periodically checks the consistency of files stored in the cache. To check consistency, the CacheFS software compares the current modification time to the previous modification time. If the modification times are different, all data and attributes for the directory or file are purged from the cache. Then, new data and attributes are retrieved from the back file system.
Consistency checks can be performed only when you explicitly request checks for file systems that are mounted by using the -o demandconst option. If you mount a file system in a cache with this option, then use the cfsadmin command with the -s option to request a consistency check. By default, consistency checking is performed file by file as the files are accessed. If no files are accessed, no checks are performed. Using the -o demandconst option avoids the situation where the network is flooded with consistency checks.
For more information, see mount_cachefs(1M).
Become superuser on the client system.
Mount the file system in the cache and specify cache consistency checking.
# mount -F cachefs -o backfstype=nfs,cachedir=/directory,demandconst server:/file-system /mount-point |
Initiate consistency checking on a specific CacheFS file system.
# cfsadmin -s /mount-point |
Become superuser on the client system.
Unmount the CacheFS file system.
# umount /mount-point |
where /mount-point specifies the CacheFS file system that you want to delete.
Determine the name of the CacheFS file system (cache ID).
# cfsadmin -l /cache-directory cfsadmin: list cache FS information maxblocks 90% minblocks 0% threshblocks 85% maxfiles 90% minfiles 0% threshfiles 85% maxfilesize 3MB cache-ID # |
Delete the CacheFS file system from the specified cache.
# cfsadmin -d cache-ID /cache-directory |
Indicates the name of the CacheFS file system, which is the last line of the cfsadmin -l output. For more information, see How to Display Information About a CacheFS File System. You can delete all the CacheFS file systems in a particular cache by specifying all for cache-ID.
Specifies the directory where the cache resides.
Verify that the CacheFS file system has been deleted.
The cache ID of the file system you just deleted should be missing from the cfsadmin -l output.
# cfsadmin -l /cache-directory cfsadmin: list cache FS information maxblocks 90% minblocks 0% threshblocks 85% maxfiles 90% minfiles 0% threshfiles 85% maxfilesize 3MB # |
For more information about the fields that are specified in the command output, refer to cfsadmin(1M).
Update the resource counts for the cache.
# fsck -F cachefs /cache-directory |
For more information, see How to Check the Integrity of a CacheFS File System.
The following example shows how to delete the file systems from the cache.
# umount /cfssrc # cfsadmin -l /cfssrc # cfsadmin -d _dev_dsk_c0t6d0s0:_cfssrc # cfsadmin -l # fsck -F cachefs /cache-directory |
Use the fsck command to check the integrity of CacheFS file systems. The CacheFS version of the fsck command automatically corrects problems without requiring user interaction. You should not need to run the fsck command manually for CacheFS file systems because the fsck command is run automatically at boot time or when the file system is mounted. If you want to manually check the integrity, you can use the following procedure.
For more information, see fsck_cachefs(1M).
Become superuser on the client system.
Check the file systems in the specified cache.
# fsck -F cachefs [-m -o noclean] /cache-directory |
Causes the fsck command to check a CacheFS file system without making any repairs.
Forces a check on the CacheFS file systems only. Does not make any repairs.
Indicates the name of the directory where the cache resides.
The following example shows how to check the file systems cached in the /local/mycache cache.
# fsck -F cachefs /local/mycache # |
The following task map describes the procedures that are associated with packing a CacheFS file system. All of these procedures are optional.
Task |
Description |
For Instructions |
---|---|---|
Pack files in the cache. |
Identify files and directories to be loaded in the cache and pack them. Packing ensures that current copies of these files are available in the cache. | |
Create a packing list. |
Create a packing list if you do not want to specify each individual file that you want packed in the cache. | |
Pack files in the cache with a packing list. |
Specify the name of the packing list of the files to be packed in the cache. | |
Unpack files or packing lists from the cache. |
Remove a file from the cache that is no longer needed. |
How to Unpack Files or Packing Lists From the CacheHow to Unpack Files or Packing Lists From the Cache |
Display packed files information. |
View information about the files that you've packed, including their packing status. |
For general use, the CacheFS software operates automatically after it is set up, without requiring any action from the user. Files are cached on a most recently used basis. With the packing feature, you can take a more active role in managing your cache by ensuring that certain files or directories are always updated in the cache.
You can specify files and directories to be loaded in the cache by using the cachefspack command. This command ensures that current copies of these files are available in the cache.
The packing list contains the names of specific files and directories. The packing list can also contain other packing lists. This feature saves you from having to specify individual files and directories when you have many items to pack in your cache.
You can print out a brief help summary of all the cachefspack options by using the -h option as follows:
$ cachefspack -h Must select 1 and only 1 of the following 5 options -d Display selected filenames -i Display selected filenames packing status -p Pack selected filenames -u Unpack selected filenames -U Unpack all files in directory 'dir' -f Specify input file containing rules -h Print usage information -r Interpret strings in LIST rules as regular expressions -s Strip './' from the beginning of a pattern name -v Verbose option files - a list of filenames to be packed/unpacked |
$ cachefspack -p filename |
Specifies that you want the file or files to be packed. This option is also the default.
Specifies the name of the file or directory you want packed in the cache. When you specify a directory, all of its subdirectories are also packed. For more information, see cachefspack(1M).
The following example shows the projects file being packed in the cache.
$ cachefspack -p projects |
The following example shows three files being packed in the cache.
$ cachefspack -p projects updates master_plan |
The following example shows a directory being packed in the cache.
$ cachefspack -p /data/abc/bin |
Display packed files information.
$ cachefspack -i[v] cached-filename-or-directory |
Specifies that you want to view information about your packed files.
Is the verbose option.
Specifies the name of the file or directory for which to display information.
The following example shows that the doc_file file has been successfully packed.
$ cachefspack -i doc_file cachefspack: file doc_file marked packed YES, packed YES |
In the following example, the /data/abc directory contains the bin subdirectory. The bin subdirectory has three files: big, medium, and small. Although the big and small files are specified to be packed, they are not. The medium file is successfully packed.
$ cd /data/abc $ cachefspack -i bin . . . cachefspack: file /bin/big marked packed YES, packed NO cachefspack: file /bin/medium marked packed YES, packed YES cachefspack: file /bin/small marked packed YES, packed NO . . . |
If you use the -iv options together, you get additional information as to whether the file or directory specified has been flushed from the cache. For example:
$ cd /data/bin FSCACHEPACK-4$ cachefspack -iv bin . . . cachefspack: file /bin/big marked packed YES, packed NO, nocache YES cachefspack: file /bin/medium marked packed YES, packed YES, nocache NO cachefspack: file /bin/small marked packed YES, packed NO nocache NO . . . |
The last line of this example shows that the directory contents have not been flushed from the cache.
One feature of the cachefspack command is the ability to create packing lists.
A packing list contains files or directories to be packed in the cache. If a directory is in the packing list, all of its subdirectories and files will also be packed.
This feature saves the time of having to specify each individual file that you want packed in the cache.
Create a packing list file by using vi.
The packing list file format uses the same format as the filesync command. For more information, see filesync(1).
Two packing list features are the following:
You can identify files in the packing list as regular expressions rather than literal file names so that you don't have to specify each individual file name.
You can pack files from a shared directory by ensuring that you pack only those files that you own.
For more information on using these features, see cachefspack(1M).
The following example shows the contents of a packing list file.
BASE /home/ignatz LIST plans LIST docs IGNORE *.ps |
The path identified with the BASE statement is the directory where you have items you want to pack.
The two LIST statements identify specific files within that directory to pack.
The IGNORE statement identifies the file type of .ps, which you do not want to pack.
Pack files in the packing list.
$ cachefspack -f packing-list |
Specifies that you want to use a packing list.
Specifies the name of the packing list.
This example uses the list.pkg file as the packing list for the cachefspack command.
$ cachefspack -f list.pkg |
You might need to remove, or unpack, a file from the cache. Perhaps you have some files or directories that have a higher priority than others, so you need to unpack the less critical files. For example, you finished up a project and have archived the files that are associated with that project. You are now working on a new project, and therefore, a new set of files.
Unpack files or packing lists from the cache.
$ cachefspack -u filename | -U cache-directory |
Specifies that you want the file or files unpacked. You must specify a file name with this option.
Specifies the name of the file or packing list that you want unpacked in the cache.
Specifies that you want to unpack all files in the cache.
For more information, see cachefspack(1M).
The following example shows the file /data/abc/bin/big being unpacked from the cache.
$ cachefspack -u /data/abc/bin/big |
The following example shows three files being unpacked from the cache.
$ cd /data/abc/bin/big $ cachefspack -u big small medium |
The following example shows how to unpack a packing list. A packing list is a file that contains the path to a directory of files:
$ cachefspack -uf list.pkg |
The following example uses the -U option to specify that all files in a cache directory being unpacked.
$ cachefspack -U /local/mycache |
You cannot unpack a cache that does not have at least one file system mounted. With the -U option, if you specify a cache that does not contain mounted file systems, output similar to the following is displayed:
$ cachefspack -U /local/mycache cachefspack: Could not unpack cache /local/mycache, no mounted filesystems in the cache. |
You might see the following error messages when you use the cachefspack command.
cachefspack: pathname - can't open directory: permission denied |
You might not have the correct permissions to access the file or directory.
Set the correct permissions.
cachefspack: pathname - can't open directory: no such file or directory |
You might not have specified the correct file or directory.
Check for a possible typo.
cachefspack: pathname - can't open directory: stale NFS file handle |
The file or directory might have been moved or deleted from the server at the time you attempted to access it.
Verify that the file or directory on the server is still accessible.
cachefspack: pathname - can't open directory: interrupted system call |
You might have inadvertently pressed Control-C while issuing the command.
Reissue the command.
cachefspack: pathname - can't open directory: I/O error |
You might have a hardware problem.
Check your hardware connections.
cachefspack: error opening dir |
You might not have specified the correct file or directory. The path identified after the BASE command in the file format could be a file and not a directory. The path specified must be a directory.
Check for a possible typo. Check the path identified after the BASE command in your file format. Ensure that the path identifies a directory, not a file.
cachefspack: unable to get shared objects |
The executable might be corrupt or in a format that is not recognizable.
Replace the executable.
cachefspack: filename - can't pack file: permission denied |
You might not have the correct permissions to access the file or directory.
Set the correct permissions.
cachefspack: filename - can't pack file: no such file or directory |
You might not have specified the correct file or directory.
Check for a possible typo.
cachefspack: filename- can't pack file: stale NFS file handle |
The file or directory might have been moved or deleted from the server at the time you attempted to access it.
Verify that the file or directory on the server is still accessible.
cachefspack: filename- can't pack file: interrupted system call |
You might have inadvertently pressed Control-C while issuing the command.
Reissue the command.
cachefspack: filename- can't pack file: I/O error |
You might have a hardware problem.
Check your hardware connections.
cachefspack: filename- can't pack file: no space left on device. |
The cache is out of disk space.
You need to increase the size of the cache by increasing disk space.
cachefspack: filename - can't unpack file: permission denied |
You might not have the correct permissions to access the file or directory.
Set the correct permissions.
cachefspack: filename - can't unpack file: no such file or directory |
You might not have specified the correct file or directory.
Check for a possible typo.
cachefspack: filename- can't unpack file: stale NFS file handle |
The file or directory might have been moved or deleted from the server at the time you attempted to access it.
Verify that the file or directory on the server is still accessible.
cachefspack: filename- can't unpack file: interrupted system call |
You might have inadvertently pressed Control-C while issuing the command.
Reissue the command.
cachefspack: filename- can't unpack file I/O error |
You might have a hardware problem.
Check your hardware connections.
cachefspack: only one `d', `i', `p', or `u' option allowed |
You specified more than one of these options in a command session.
Select one option for the command session.
cachefspack: can't find environment variable. |
You forgot to set a corresponding environment variable to match the $ in your configuration file.
Define the environment variable in the proper location.
cachefspack: skipping LIST command - no active base |
A LIST command is present in your configuration file but has no corresponding BASE command.
Define the BASE command.
The following task map shows the steps involved in collecting CacheFS statistics. All these procedures are optional.
Task |
Description |
For Instructions |
---|---|---|
Set up logging. |
Set up logging on a CacheFS file system by using the cachefslog command. | |
Locate the log file. |
Locate the log file by using the cachefslog command. | |
Stop logging. |
Stop logging by using the cachefslog command. | |
View the cache size. |
View the cache size by using the cachefswssize command. | |
View the cache statistics. |
View the statistics by using the cachefsstat command. |
Collecting CacheFS statistics enables you to do the following:
Determine an appropriate cache size.
Observe the performance of the cache.
These statistics help you determine the trade-off between your cache size and the desired performance of the cache.
The following table describes the CacheFS statistics commands.
Command |
Description |
Man Page |
---|---|---|
cachefslog |
Specifies the location of the log file. This command also displays where the statistics are currently being logged, and enables you to stop logging. | |
cachefswssize |
Interprets the log file to give a recommended cache size. | |
cachefsstat |
Displays statistical information about a specific CacheFS file system or all CacheFS file systems. The information provided in the command output is taken directly from the cache. |
You can issue the CacheFS statistics commands from any directory. You must be superuser to issue the cachefswssize command.
The CacheFS statistics begin accumulating when you create the log file. When the work session is over, stop the logging by using the cachefslog -h command, as described in How to Stop CacheFS Logging.
Before using the CacheFS statistics commands, you must do the following:
Set up your cache by using the cfsadmin command.
Decide on an appropriate length of time to allow statistical information to collect in the log file you create. The length of time should equal a typical work session. For example, a day, a week, or a month.
Select a location or path for the log file. Ensure that sufficient space to allows for the growth of the log file. The longer you intend to allow statistical information to collect in the log file, the more space you need.
The following procedures are presented in a recommended order. This order is not required.
$ cachefslog -f log-file-path /mount-point |
Sets up logging.
Specifies the location of the log file. The log file is a standard file you create with an editor, such as vi.
Designates the mount point (CacheFS file system) for which statistics are being collected.
Verify that you correctly set up the log file.
$ cachefslog /mount-point |
The following example shows how to set up the /var/tmp/samlog log file to collect statistics about the /home/sam directory.
$ cachefslog -f /var/tmp/samlog /home/sam /var/tmp/samlog: /home/sam |
Display where CacheFS statistics are being logged.
$ cachefslog /mount-point |
where /mount-point specifies the CacheFS file system for which you want to view the statistics.
You can also use the cachefslog command with no options to locate a log file for a particular mount point.
The following example shows what you would see if a log file has been set up. The location of the log file is /var/tmp/stufflog.
$ cachefslog /home/stuff /var/tmp/stufflog: /home/stuff |
The following example shows that no log file has been set up for the specified file system.
$ cachefslog /home/zap not logged: /home/zap |
Use the cachefslog -h option to stop logging.
$ cachefslog -h /mount-point |
The following example shows how to stop logging on /home/stuff.
$ cachefslog -h /home/stuff not logged: /home/stuff |
If you get a system response other than the response specified here, you did not successfully stop logging. Determine if you are using the correct log file name and mount point.
You might want to check if you need to increase the size of the cache. Or, you might want to determine the ideal cache size based on your activity since you last used the cachefslog command for a particular mount point.
Become superuser on the client system.
View the current cache size and highest logged cache size.
# cachefswssize log-file-path |
For more information, see cachefswssize(1M).
In the following example, the end size is the size of the cache at the time you issued the cachefswssize command. The high water size is the largest size of the cache during the timeframe in which logging occurred.
# cachefswssize /var/tmp/samlog /home/sam end size: 10688k high water size: 10704k / end size: 1736k high water size: 1736k /opt end size: 128k high water size: 128k /nfs/saturn.dist end size: 1472k high water size: 1472k /data/abc end size: 7168k high water size: 7168k /nfs/venus.svr4 end size: 4688k high water size: 5000k /data end size: 4992k high water size: 4992k total for cache initial size: 110960k end size: 30872k high water size: 30872k |
The following table explains the terminology that is displayed in the statistics output for CacheFS file systems.
Table 20–2 CacheFS Statistics Terminology
Output Term |
Description |
---|---|
cache hit rate |
The rate of cache hits compared to cache misses, followed by the actual number of hits and misses. A cache hit occurs when the user wants to perform an operation on a file or files, and the file or files are actually in the cache. A cache miss occurs when the file is not in the cache. The load on the server is the sum of cache misses, consistency checks, and modifications (modifies). |
consistency checks |
The number of consistency checks performed, followed by the number that passed, and the number that failed. |
modifies |
The number of modify operations. For example, writes or creates. |
View the statistics with the cachefsstat command. You can view the statistics at any time. For example, you do not have to set up logging in order to view the statistics.
View CacheFS statistics.
$ cachefsstat /mount-point |
where /mount-point specifies the CacheFS file system for which you want to view the statistics.
If you do not specify the mount point, statistics for all mounted CacheFS file systems will be displayed.
This example shows how to view statistics on the cached file system, /home/sam.
$ cachefsstat /home/sam cache hit rate: 73% (1234 hits, 450 misses) consistency checks: 700 (650 pass, 50 fail) modifies: 321 garbage collection: 0 |