Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
40.  Using The CacheFS File System (Tasks) Creating and Mounting a CacheFS File System (Task Map) How to Mount a CacheFS File System (mount)  Previous   Contents   Next 
   
 

Examples--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 vold is 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

How to Mount a CacheFS File System (/etc/vfstab)

  1. Become superuser on the client system.

  2. Using an editor, specify the file systems to be mounted in the /etc/vfstab file.

    See the example that follows.

    For more information on the /etc/vfstab file, see "Field Descriptions for the /etc/vfstab File".

  3. Mount the CacheFS file system.

    # mount /mount-point

    Or, reboot the system.

Example--Mounting a CacheFS File System (/etc/vfstab)

The following example shows the /etc/vfstab entry for the /data/abc directory from 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

How to Mount a CacheFS File System (AutoFS)

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 automount(1M).

  1. Become superuser on the client system.

  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. Using an editor, add the following line to the auto_master map:

    /-

    The /- entry is a pointer to check the auto_direct map.

  4. Reboot the system.

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

For more information about AutoFS and how to edit the maps, refer to "Autofs Administration Task Overview" in System Administration Guide: Resource Management and Network Services.

Example--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

Maintaining a CacheFS File System (Task Map)

After a CacheFS file system is set up, it requires little maintenance. Use the optional procedures in this table if you need to perform maintenance tasks on your CacheFS file systems.

Task

Description

For Instructions

1. Modify a CacheFS file system

Modify CacheFS file system behavior by unmounting, deleting, or re-creating the cache.

"Modifying a CacheFS File System"

2. Display CacheFS file system information

Display information about CacheFS file systems by using the cfsadmin command.

"How to Display Information About a CacheFS File System"

3. Perform consistency checking

Perform consistency checking on demand by using the cfsadmin command.

"How to Specify Cache Consistency Checking on Demand"

4. Delete a CacheFS file system

Delete a CacheFS file system by using the umount command and the cfsadmin command.

"How to Delete a CacheFS File System"

5. Check the integrity of a CacheFS file system

Check the integrity of a CacheFS file system by using the fsck_cachefs command.

"How to Check the Integrity of a CacheFS File System"

Maintaining a CacheFS File System

This section describes how to maintain a CacheFS file system.

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.

Modifying a CacheFS File System

When you modify a file system in the cache, you need to delete the cache and then re-create it. You might also need to reboot your machine in single-user mode, depending on how your file systems are shared and accessed.

In the following example, the cache is deleted, re-created, and then mounted again with the demandconst option specified for the /docs file system.

# shutdown -g30 -y
.
.
.
Type Cntrl-d to proceed with normal startup,
(or give root password for system maintenance):
# enter password:
.
.
.
Here is where you might be prompted to run fsck on the
file system where the cache is located.

# fsck /local
# mount /local
# cfsadmin -d all /local/mycache
# cfsadmin -c /local/mycache
# init 6
.
.
.
console login:
password:
# mount -F cachefs -o backfstype=nfs,cachedir=/local/cache1,demandconst
merlin:/docs /docs
#
 
 
 
  Previous   Contents   Next