Previous Table of Contents Next


Creating a Mount Point

Regardless 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 cache-directory and press Return. In this example, a mount point named /cachemount is created:

# mkdir /docs-cachemount

Specifying a File System (mount)

You provide the following parameters for the mount command:

  The file system type of the back file system on the server: backfstype=fstype.
  The name of the cache directory: cachedir=cache-directory.
  The name of the back file system: back-filesystem.
  The mount point: mount-point.

Follow these steps to mount a cache file system from a command line:

1.  On the client system, become superuser.
2.  Type mount -F cachefs -o backfstype= fstype, cachedir= cache-directory[,options] back-file-system mount-point and press Return.
3.  Type cachefsstat mount-point and press Return. The output from this command verifies that the cache you created was mounted.

In this example, a mount point named /docs-cachemount is created and the NFS file system castle:/docs is mounted as a cached file system named /docs-cachemount in the cache named /local/cachfile:

oak% su
# mkdir /docs-cachemount
# mount -f cachefs -o backfstype=nfs,cachedir=/local/cachefile
castle:/docs /docs-cachemount
# cachefsstat /docs-cachemount
/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 /docs-cachemount
cachefsstat: /docs-cachemount 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.

Follow these steps to mount a cache file system the /etc/vfstab file:

1.  On the client system, become superuser.
2.  Using an editor, add the following line to the /etc/vfstab file:
/dev/dsk/device-name /dev/rdsk/device-name /mount-point cachefs
2 yes  -
3.  Type mount mount-point and press Return or reboot the system to mount the file system.

In this example, the /usr/local directory is mounted in the cache directory:

/dev/disk/c0t1d0s0  /dev/rdsk/c0t1d0s0  /cache  ufs  2  yes  -

Specifying a File System (AutoFS Map)

You add a cache file system to the auto_direct AutoFS map by specifying the -fstype=cachefs mount option. 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 refer to the Solaris Advanced System Administrator's Guide available from Sun Microsystems Press.

Follow these steps to specify a cache file system in the AutoFS map:

1.  Become superuser.
2.  Using an editor, add the following line to the auto_direct map:
/mount-point -fstype=cachefs,cachedir=/directory,
backfstype=nfs server:/file-system
3.  Reboot the system.
4.  Type cd files-system and press Return.
5.  Type ls files-system and press Return. Review the output of the ls command to verify that the entry was made correctly.

Maintaining Caches

After you set up cache file systems, you can perform the following maintenance tasks on them:

  Modify file systems in the cache by unmounting, deleting, re-creating, and remounting the cache
  Display cache information
  Check cache consistency
  Delete a file system from the cache
  Check cached file system integrity

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.

Table 4-9 lists the Commands for Maintaining Cache File Systems lists the commands that you can use to perform cache maintenance. Refer to the appropriate manual page for more details.

Table 4-9 Commands for Maintaining Cache File Systems

Command Description
cfsadmin Enables you to display information about cached file systems, delete a cached file system from a specified cache, and specify consistency checking on demand. See the cfsadmin(1M) manual page for more information.
cachefspack Enables you to create packing lists that specify individual files and directories that you want packed in the cache. A packing list contains files or directories to be packed in the cache. If a directory is in the packing list, all its subdirectories and files are also packed. See the cachefspack(1M) manual page for more information.
cachefslog Specifies the location of a CacheFS log file. This command also displays were statistics are currently being logged and enables you to halt logging. See the cachefslog(1M) manual page for more information.
cachefswssize Interprets the log file to give a recommended cache size. See the cachefsswsize(1M) manual page for more information.
cachefsstat Displays statistical information about a specific file system or all cached file systems. The information provided in the output of this command is taken directly from the cache. See the cachefsstat(1M) manual page for more information
fsck -F cachefs {-m} {-o noclean} cache-directory Checks the integrity of cached file systems and automatically corrects problems without requiring user interaction. See the fsck_cachefs (1M) manual page for more information.


Previous Table of Contents Next