| United States-English |
|
|
|
![]() |
NFS Services Administrator’s Guide: HP-UX 11i version 3 > Chapter 4 Configuring and Administering a Cache FilesystemConfiguring and Administering CacheFS |
|
You can use CacheFS to cache both manually mounted NFS filesystems or automatically mounted NFS filesystems. All CacheFS operations, except displaying CacheFS statistics, require superuser permissions. This section describes the tasks to configure and administer CacheFS: This section describes how to configure a cache directory in a local filesystem. To configure a local filesystem as a cache directory, follow these steps:
CacheFS allows more than one filesystem to be cached in the same cache. You need not create a separate cache directory for each CacheFS mount. This section describes how to mount an NFS filesystem using CacheFS. The syntax for mounting an NFS filesystem using CacheFS is as follows:
Consider the following example where the /opt/frame directory is going to be NFS-mounted from the NFS server nfsserver to the local /opt/cframe directory. To mount the example NFS filesystem using CacheFS manually, enter the following command on an NFS client system:
The /opt/frame directory can now be accessed like any other mounted filesystem. When data in /opt/cframe is referenced, it is copied into /disk2/cache. To mount an NFS filesystem using CacheFS automatically at system boot, add the following line to the /etc/fstab file:
When data in the /opt/cframe directory is accessed for the first time, the requested data is retrieved across the network from the NFS server. A copy of this data is then placed in the local cache directory. All future accesses to the data will be served from the local cache, assuming the data has not been modified on the server. When a CacheFS filesystem is mounted, a file or CacheId is created in the cache directory for it. The name of the file is of the form:
Where each “/” is replaced by “_”. The CacheId is unique for each CacheFS mount-point and is a link into the part of a cache directory assigned to that mount-point. For example:
Users can explicitly specify the CacheId using the cache ID mount option. If you do not specify a cache ID, CacheFS constructs one. CacheFS is commonly used when the data on the server is read a number of times and rarely modified. For example, consider a filesystem that is initially mounted with the noconst option. The mount option has been chosen because the data on the server is rarely modified. If for some reason the data on the server is modified, you may want to change the mount options. In earlier versions of HP-UX, if you mounted a filesystem with certain mount options, you could not change those mount options without deleting or recreating the cache. Starting with HP-UX 11i v3, you can switch mount options without deleting and recreating the cache. To change the mount option from noconst to the default option, without deleting or rebuilding the cache, enter the following commands:
To change the mount option from default to weakconst after unmounting, enter the following command:
For more information on the various mount options of the CacheFS filesystem, see mount_cachefs(1M). This section describes how to automount a filesystem using CacheFS. Before you automount an NFS filesystem using CacheFS, you must configure a directory in a local filesystem as cache. For more information on how to configure a directory as cache, see “Creating a CacheFS Cache”. To automount a filesystem using CacheFS, follow these steps:
You can specify caching in an NIS AutoFS map, or by using LDAP, only if all the clients who use the map have their caching directory set up in the same location (/disk2/cache in the examples). This section describes how you can enable logging in CacheFS. You can use the cachefslog command to enable logging for a CacheFS mount-point. Enabling the logging functionality may have a performance impact on the operations performed for all the CacheFS mount-points that are using the same cache directory. To enable CacheFS logging, follow these steps:
You can use the cachefslog command to halt or disable logging for a CacheFS mount-point. To disable CacheFS logging, follow these steps:
CacheFS is designed to work best with NFS filesystems that contain stable read-only data. One of the most common uses of CacheFS is managing application binaries. These are typically read-only and are rarely ever modified. They are modified when new versions of the application are installed or a patch containing a modified binary is installed. The rpages mount option enables you to cache a complete binary file. When an application in a cached NFS filesystem is executed, CacheFS checks if the binary file is cached. If it is not cached, then the client reads the entire binary file and automatically caches it. If the rpages mount option is not used, only the accessed portion of the binary is cached. Using the rpages mount option causes slower initial load times, but subsequent executions of the application binary are significantly faster. For example, to load the netscape binary, do the following:
For more information on the rpages mount option, see mount_cachefs(1M). Starting with HP-UX 11i v3, the cachefspack command is introduced to provide greater control over the cache. This command enables you to specify files and directories to be loaded, or packed, in the cache. It also ensures that the current copies are always available in the cache. You can pack files using one of the following methods:
You can unpack files that you no longer require, using one of the following methods:
CacheFS periodically checks the consistency of files when a user attempts to access the file stored in the cache. This ensures that the cached directories and files are up to date with the back filesystem. To check consistency, CacheFS compares the time stamp of the cached file with the time stamp of the corresponding file on the back filesystem. If CacheFS detects a time difference, the cached data is purged, and the updated data is retrieved from the back filesystem. If you have not accessed any files, checks are not performed. Use of this option does not result in a sudden “storm” of consistency checks. By default, CacheFS verifies the consistency of the cached contents against the back filesystem every 30 seconds. However, if you want to disable these automatic consistency checks and instead perform manual consistency checks you can mount the CacheFS filesystem with the demandconst option, and then use the cfsadmin command to force a consistency check. To force a consistency check on a specific mount-point, enter the following command:
To request for a consistency check on all the mount-points, enter the following command:
For information on cfsadmin options, see cfsadmin(1M). To unmount a Cache filesystem, enter the following command: umount mount-point where:
You can use the fsck command to check the integrity of a cache. The CacheFS version of the fsck command checks the integrity of the cache and automatically corrects any CacheFS problems that it encounters. The CacheFS fsck command is run automatically by the mount command when the cache directory is accessed for the first time after a system reboot. The command is run either during system bootup if there is an entry in /etc/fstab, or the first time the cache directory is referenced as part of the mount operation. To manually check the integrity of a cache, enter the following command:
where:
The cache directory must not be in use while performing a cache integrity check using the fsck command. To list the CacheFS mount-points that are using a specific cache directory, for example, /disk2/cache, enter the following command:
An output similar to the following is displayed if CacheFS mount-points are using the cache directory:
You must now unmount these mount-points before you check the integrity of a cache. For information on how to unmount a cache mount-point, see “Unmounting a Cache Filesystem”. For more information on the fsck_cachefs command of CacheFS, see fsck_cachefs(1M). Each cache has a set of parameters that determines its structure and how it behaves. When a cache directory is created, it gets created with default values for the resource parameters. Table 4-1 lists the various resource parameters and their default values. Table 4-1 CacheFS Resource Parameters
For more information on the resource parameters, see cfsadmin(1M). You can update the resource parameters using the -u option of the cfsadmin command.
For example, to update the resource parameter, maxblocks, you must first create the cache, and then modify the parameter as follows:
This updates the value of maxblocks from 90 which is the default value to 95. To delete a cache directory that is no longer required you must use the cfsadmin command. The syntax to delete the cache directory is as follows: cfsadmin -d {cacheID | all} cache-directory where:
To delete the cache directory, follow these steps:
To delete a cache directory and all the CacheFS filesystems in that directory, enter the following command: cfsadmin -d all cache-directory |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||