System Administration Guide: Devices and File Systems

ProcedureHow to Mount a CacheFS File System (mount)

  1. Become superuser on the client system.

  2. 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.

  3. Mount a file system in the cache.


    # 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, which can be either NFS or HSFS.

    /cache-directory

    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.

    options

    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).

    /back-filesystem

    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.

    /mount-point

    Indicates the directory where the file system is mounted.

  4. 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.


Example 20–2 Mounting a CacheFS File System (mount)

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