NFS Services Administrator's Guide (B1031-90072, March 2011)
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.
Mounting an NFS Filesystem Using CacheFS
This section describes how to mount an NFS filesystem using CacheFS. The syntax for mounting
an NFS filesystem using CacheFS is as follows:
mount [-F cachefs] [-rqOV] -o backfstype=file_system_type
[specific_options] resource mount_point
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:
mount -F cachefs -o backfstype=nfs, \
cachedir=/disk2/cache nfsserver:/opt/frame /opt/cframe
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:
nfsserver:/opt/frame /opt/cframe cachefs \
backfstype=nfs,cachedir=/disk2/cache 0 0
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:
NFS_server:mounted_directory:mount-point
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:
NFSserver : nfss04
Mounted directory : /exp
Mount-point : /mnt
symbolic name : nfss04:_exp:_mnt
Users can explicitly specify the CacheId using the cache ID mount option. If you do not specify
a cache ID, CacheFS constructs one.
Switching Mount Options
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:
umount /mnt1
mount -F cachefs -o backfstype=nfs,cachedir=/cache
CFS1:/tmp /mnt1
Configuring and Administering CacheFS 83