|Skip Navigation Links|
|Exit Print View|
|System Administration Guide: Devices and File Systems Oracle Solaris 10 8/11 Information Library|
Use the procedures in this task map to create and mount a CacheFS file system.
# cfsadmin -c /cache-directory
where cache-directory indicates the name of the directory where the cache resides.
For more information, see cfsadmin(1M).
Note - After you have created the cache, do not perform any operations within the cache directory itself. Doing so could cause conflicts within the CacheFS software.
Example 18-1 Creating the Cache
The following example shows how to create a cache in the /local/mycache directory by using the default cache parameter values.
# mkdir /local # cfsadmin -c /local/mycache
You specify a file system to be mounted in the cache so that users can locally access files in that file system. The files do not actually get placed in the cache until the user accesses the files.
The following table describes three ways to mount a CacheFS file system.
Choose the method of mounting file systems that best suits your environment.
You can mount only file systems that are shared. For information on sharing file systems, see share(1M).
Note - The caching of the root (/) and /usr file systems is not supported in a CacheFS file system.
# 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.
# mount -F cachefs -o backfstype=fstype,cachedir=/cache-directory[,options] /back-filesystem /mount-point
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.
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).
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.
Indicates the directory where the file system is mounted.
# cachefsstat /mount-point
The /mount-point is the CacheFS file system that you created.
# 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 18-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 10 DVD available as a CacheFS file system named /cfssrc. Because you cannot write to the DVD, 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 /sol10 # mount -F cachefs -o backfstype=hsfs,cachedir=/cfs/cache,ro,noconst, backpath=/sol10 /dev/dsk/c0t6d0s0 /cfssrc # ls /cfssrc Copyright Solaris_10
The following example shows how to mount a Solaris 10 DVD as a CacheFS file system with vold running.
# mount -F cachefs -o backfstype=hsfs,cachedir=/cfs/cache,ro,noconst, backpath=/cdrom/sol_10_sparc/s0 /vol/dev/dsk/c0t2d0/sol_10_sparc/s0 /cfssrc
The following example shows how to mount a DVD 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
See the example that follows.
For more information on the /etc/vfstab file, see Field Descriptions for the /etc/vfstab File.
# mount /mount-point
Or, reboot the system.
Example 18-3 Mounting a CacheFS File System (/etc/vfstab)
The following example shows the /etc/vfstab entry for the /data/abc directory from the remote system starbug that is mounted in the cached directory, /opt/cache.
#device device mount FS fsck mount mount #to mount to fsck point type pass at boot options # starbug:/data/abc /local/abc /opt/cache cachefs 7 yes local-access,bg, nosuid,demandconst,backfstype=nfs,cachedir=/opt/cache
You can mount a file system in a cache with autofs by specifying the -fstype=cachefs mount option in your automount map. Note that the CacheFS mount options, for example, backfstype and cachedir, are also specified in the automount map.
For details on automount maps, see Task Overview for Autofs Administration in System Administration Guide: Network Services or automount(1M).
/mount-point -fstype=cachefs,cachedir=/directory,backfstype=nfs server:/file-system
The /- entry is a pointer to check the auto_direct map.
# cd /filesystem # ls
Example 18-4 Mounting a CacheFS File System (autofs)
The following auto_direct entry automatically mounts the CacheFS file system in the /docs directory.
/docs -fstype=cachefs,cachedir=/local/mycache,backfstype=nfs merlin:/docs