You specify file systems to be mounted in the cache so that users can locally access files in the file system you've specified. The files do not actually get placed in the cache until the user accesses the files.
There are three ways to specify file systems to be cached:
Using the mount(1M) command - you need to use the mount command every time the system reboots in order to access the same file system.
Editing the /etc/vfstab file - you only need to do this once. The /etc/vfstab file will remain unaltered after the system reboots.
Using AutoFS - you only need to do this once. AutoFS maps remain unaltered after the system reboots.
Choose the method of mounting file systems you are most familiar with.
Caching of the root (/) and /usr file systems is not supported in CacheFS. To cache the root (/) and /usr file systems, you must purchase the Solstice AutoClient product. For more information about the AutoClient product, see the Solstice AutoClient 2.1 Administration Guide.
Become superuser.
Create a mount point.
The mount point allows user access to the file system specified under that mount point. You can create the mount point from anywhere. The CacheFS options used with the mount command, as shown in the next step, will determine that the mount point you created will be cached in the cache directory you specified.
Mount a file system in a cache with the mount command.
# mount -F cachefs -o backfstype=fstype,cachedir=cache-directory[, options] back-filesystem mount-point |
fstype |
Indicates the file system type of the back file system (can be either nfs or hsfs). |
cache-directory |
Indicates the name of the directory where the cache resides. This is the same name you specified when you created the cache in "How to Create a Cache". |
options |
Specifies other mount options that you can include when mounting a file system in a cache. See mount_cachefs(1M) for a list of CacheFS mount options. |
back-filesystem |
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: /usr/openwin |
mount-point |
Indicates the directory where the file system is mounted. |
Verify that the cache you created was actually mounted by using the cachefsstat(1M) command, as follows:
# cachefsstat mount-point |
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 |
The mount point is the cached file system you created. For more information about the cachefsstat command, see "CacheFS Statistics".
If the file system was not mounted in the cache, you will receive an error message similar to the following:
# cachefsstat mount-point cachefsstat: mount-point: not a cachefs mountpoint |
The following example creates the mount point /docs, and mounts the NFS file system merlin:/docs as a cached 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 makes a CD-ROM (HSFS file system) available as a cached file system named /docs. Because you cannot write to the CD-ROM, the ro argument is specified to make the cached file system read-only. You must specify the backpath option because Volume Management automatically mounts the CD-ROM when it is inserted. The mount point is in the /cdrom directory and is determined by the name of the CD-ROM. The special device to mount is the same as the value for the backpath command.
# mount -F cachefs -o backfstype=hsfs,cachedir=/local/mycache,ro backpath=/cdrom/cdrom_name /cdrom/cdrom_name /docs |
The following example uses the demandconst option to specify consistency checking on demand for the NFS cached file system /docs, whose back file system is merlin:/docs. See "Consistency Checking of Cached File Systems With the Back File System" for more information.
# mount -F cachefs -o backfstype=nfs,cachedir=/local/mycache,demandconst merlin:/docs /docs |
Become superuser.
Using an editor, specify the file systems to be mounted in the /etc/vfstab file:
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # /dev/dsk/devicename /dev/rdsk/devicename /mount-point cachefs 2 yes - |
This line represents the new entry.
Mount the cached file system using the mount command, as follows:
# mount /mount-point |
or reboot.
The following example shows the /etc/vfstab entry for the cache file system.
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # /dev/dsk/c0t1d0s0 /dev/rdsk/c0t1d0s0 /usr/local cachefs 2 yes - |
The /usr/local directory is mounted in the cache directory.
# mount /usr/local |
You can mount a file system in a cache with AutoFS by specifying the -fstype=cachefs mount option in your automount map. Note that CacheFS mount options (for example, backfstype and cachedir) are also specified in the automount map. See automount(1M) for details on automount maps. Also see the NFS Administration Guide.
Become superuser.
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, as follows:
# cd filesystem # ls filesystem |
For more information about AutoFS and how to edit the maps, refer to the AutoFS chapter of the NFS Administration Guide.
The following auto_master entry automatically mounts the cache file system in the /docs directory.
/docs -fstype=cachefs,cachedir=/local/mycache,backfstype=nfs merlin:/docs |