System Administration Guide: Devices and File Systems
Previous Next

Packing a CacheFS File System

For general use, the CacheFS software operates automatically after it is set up, without requiring any action from the user. Files are cached on a most recently used basis. With the packing feature, you can take a more active role in managing your cache by ensuring that certain files or directories are always updated in the cache.

You can specify files and directories to be loaded in the cache by using the cachefspack command. This command ensures that current copies of these files are available in the cache.

The packing list contains the names of specific files and directories. The packing list can also contain other packing lists. This feature saves you from having to specify individual files and directories when you have many items to pack in your cache.

You can print out a brief help summary of all the cachefspack options by using the -h option as follows:

$ cachefspack -h
Must select 1 and only 1 of the following 5 options
-d Display selected filenames
-i Display selected filenames packing status
-p Pack selected filenames
-u Unpack selected filenames
-U Unpack all files in directory 'dir'
-f Specify input file containing rules
-h Print usage information
-r Interpret strings in LIST rules as regular expressions
-s Strip './' from the beginning of a pattern name
-v Verbose option
files - a list of filenames to be packed/unpacked

How to Pack Files in the Cache

  • Pack files in the cache.
    $ cachefspack -p filename
    -p

    Specifies that you want the file or files to be packed. This option is also the default.

    filename

    Specifies the name of the file or directory you want packed in the cache. When you specify a directory, all of its subdirectories are also packed. For more information, see cachefspack(1M).

Example 20-8 Examples—Packing Files in the Cache

The following example shows the projects file being packed in the cache.

$ cachefspack -p projects

The following example shows three files being packed in the cache.

$ cachefspack -p projects updates master_plan

The following example shows a directory being packed in the cache.

$ cachefspack -p /data/abc/bin

How to Display Packed Files Information

  • Display packed files information.
    $ cachefspack -i[v] cached-filename-or-directory
    -i

    Specifies that you want to view information about your packed files.

    -v

    Is the verbose option.

    cached-filename-or-directory

    Specifies the name of the file or directory for which to display information.

Example 20-9 Displaying Packed Files Information

The following example shows that the doc_file file has been successfully packed.

$ cachefspack -i doc_file
cachefspack: file doc_file marked packed YES, packed YES

In the following example, the /data/abc directory contains the bin subdirectory. The bin subdirectory has three files: big, medium, and small. Although the big and small files are specified to be packed, they are not. The medium file is successfully packed.

$ cd /data/abc
$ cachefspack -i bin
.
.
.
cachefspack: file /bin/big marked packed YES, packed NO
cachefspack: file /bin/medium marked packed YES,
packed YES
cachefspack: file /bin/small marked packed YES,
packed NO
.
.
.

If you use the -iv options together, you get additional information as to whether the file or directory specified has been flushed from the cache. For example:

$ cd /data/bin
FSCACHEPACK-4$ cachefspack -iv bin
.
.
.
cachefspack: file /bin/big marked packed YES, packed NO,
nocache YES
cachefspack: file /bin/medium marked packed YES,
packed YES, nocache NO
cachefspack: file /bin/small marked packed YES,
packed NO
nocache NO
.
.
.

The last line of this example shows that the directory contents have not been flushed from the cache.

Using Packing Lists

One feature of the cachefspack command is the ability to create packing lists.

A packing list contains files or directories to be packed in the cache. If a directory is in the packing list, all of its subdirectories and files will also be packed.

This feature saves the time of having to specify each individual file that you want packed in the cache.

How to Create a Packing List

  • Create a packing list file by using vi.

    The packing list file format uses the same format as the filesync command. For more information, see filesync(1).

    Two packing list features are the following:

    • You can identify files in the packing list as regular expressions rather than literal file names so that you don't have to specify each individual file name.

    • You can pack files from a shared directory by ensuring that you pack only those files that you own.

    For more information on using these features, see cachefspack(1M).

Example 20-10 Creating a Packing List

The following example shows the contents of a packing list file.

BASE /home/ignatz
LIST plans
LIST docs
IGNORE *.ps
  • The path identified with the BASE statement is the directory where you have items you want to pack.

  • The two LIST statements identify specific files within that directory to pack.

  • The IGNORE statement identifies the file type of .ps, which you do not want to pack.

How to Pack Files in the Cache With a Packing List

  • Pack files in the packing list.
    $ cachefspack -f packing-list
    -f

    Specifies that you want to use a packing list.

    packing-list

    Specifies the name of the packing list.

Example 20-11 Packing Files in the Cache With a Packing List

This example uses the list.pkg file as the packing list for the cachefspack command.

$ cachefspack -f list.pkg

Unpacking Files or Packing Lists From the Cache

You might need to remove, or unpack, a file from the cache. Perhaps you have some files or directories that have a higher priority than others, so you need to unpack the less critical files. For example, you finished up a project and have archived the files that are associated with that project. You are now working on a new project, and therefore, a new set of files.

How to Unpack Files or Packing Lists From the Cache

  • Unpack files or packing lists from the cache.
    $ cachefspack -u filename | -U cache-directory
    -u

    Specifies that you want the file or files unpacked. You must specify a file name with this option.

    filename

    Specifies the name of the file or packing list that you want unpacked in the cache.

    -U

    Specifies that you want to unpack all files in the cache.

    For more information, see cachefspack(1M).

Example 20-12 Unpacking Files or Packing Lists From the Cache

The following example shows the file /data/abc/bin/big being unpacked from the cache.

$ cachefspack -u /data/abc/bin/big

The following example shows three files being unpacked from the cache.

$ cd /data/abc/bin/big
$ cachefspack -u big small medium

The following example shows how to unpack a packing list. A packing list is a file that contains the path to a directory of files:

$ cachefspack -uf list.pkg

The following example uses the -U option to specify that all files in a cache directory being unpacked.

$ cachefspack -U /local/mycache

You cannot unpack a cache that does not have at least one file system mounted. With the -U option, if you specify a cache that does not contain mounted file systems, output similar to the following is displayed:

$ cachefspack -U /local/mycache
cachefspack: Could not unpack cache /local/mycache, no mounted
filesystems in the cache.

Troubleshooting cachefspack Errors

You might see the following error messages when you use the cachefspack command.

cachefspack: pathname - can't open directory: permission denied
Cause

You might not have the correct permissions to access the file or directory.

Action

Set the correct permissions.

cachefspack: pathname - can't open directory: no such file or
directory
Cause

You might not have specified the correct file or directory.

Action

Check for a possible typo.

cachefspack: pathname - can't open directory: stale NFS file handle
Cause

The file or directory might have been moved or deleted from the server at the time you attempted to access it.

Action

Verify that the file or directory on the server is still accessible.

cachefspack: pathname - can't open directory: interrupted system
call
Cause

You might have inadvertently pressed Control-C while issuing the command.

Action

Reissue the command.

cachefspack: pathname - can't open directory: I/O error
Cause

You might have a hardware problem.

Action

Check your hardware connections.

cachefspack: error opening dir
Cause

You might not have specified the correct file or directory. The path identified after the BASE command in the file format could be a file and not a directory. The path specified must be a directory.

Action

Check for a possible typo. Check the path identified after the BASE command in your file format. Ensure that the path identifies a directory, not a file.

cachefspack: unable to get shared objects
Cause

The executable might be corrupt or in a format that is not recognizable.

Action

Replace the executable.

cachefspack: filename - can't pack file: permission denied
Cause

You might not have the correct permissions to access the file or directory.

Action

Set the correct permissions.

cachefspack: filename - can't pack file: no such file or directory
Cause

You might not have specified the correct file or directory.

Action

Check for a possible typo.

cachefspack: filename- can't pack file: stale NFS file handle
Cause

The file or directory might have been moved or deleted from the server at the time you attempted to access it.

Action

Verify that the file or directory on the server is still accessible.

cachefspack: filename- can't pack file: interrupted system call
Cause

You might have inadvertently pressed Control-C while issuing the command.

Action

Reissue the command.

cachefspack: filename- can't pack file: I/O error
Cause

You might have a hardware problem.

Action

Check your hardware connections.

cachefspack: filename- can't pack file: no space left on device.
Cause

The cache is out of disk space.

Action

You need to increase the size of the cache by increasing disk space.

cachefspack: filename - can't unpack file: permission denied
Cause

You might not have the correct permissions to access the file or directory.

Action

Set the correct permissions.

cachefspack: filename - can't unpack file: no such file or directory
Cause

You might not have specified the correct file or directory.

Action

Check for a possible typo.

cachefspack: filename- can't unpack file: stale NFS file handle
Cause

The file or directory might have been moved or deleted from the server at the time you attempted to access it.

Action

Verify that the file or directory on the server is still accessible.

cachefspack: filename- can't unpack file: interrupted system call
Cause

You might have inadvertently pressed Control-C while issuing the command.

Action

Reissue the command.

cachefspack: filename- can't unpack file I/O error
Cause

You might have a hardware problem.

Action

Check your hardware connections.

cachefspack: only one `d', `i', `p', or `u' option allowed
Cause

You specified more than one of these options in a command session.

Action

Select one option for the command session.

cachefspack: can't find environment variable.
Cause

You forgot to set a corresponding environment variable to match the $ in your configuration file.

Action

Define the environment variable in the proper location.

cachefspack: skipping LIST command - no active base
Cause

A LIST command is present in your configuration file but has no corresponding BASE command.

Action

Define the BASE command.

Previous Next