对于常规用途,CacheFS 软件在设置后自动运行,而不要求用户执行任何操作。仅对最新使用的文件进行高速缓存。利用压缩功能,通过确保始终在高速缓存中更新某些文件或目录,可以在管理高速缓存方面承担更主动的角色。
使用 cachefspack 命令可以指定要在高速缓存中装入的文件和目录。此命令确保这些文件的最新副本在高速缓存中是可用的。
压缩列表包含特定文件和目录的名称。压缩列表也可以包含其他压缩列表。需要在高速缓存中压缩多个项时,利用此功能就不必指定单独的文件和目录。
使用 -h 选项可以输出所有 cachefspack 选项的简短帮助摘要,如下所示:
$ 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 |
$ cachefspack -p filename |
指定要压缩一个或多个文件。此选项也是缺省选项。
指定要在高速缓存中压缩的文件或目录的名称。指定目录时,也将压缩该目录的所有子目录。有关更多信息,请参见 cachefspack(1M)。
以下示例说明在高速缓存中压缩 projects 文件。
$ cachefspack -p projects |
以下示例说明在高速缓存中压缩三个文件。
$ cachefspack -p projects updates master_plan |
以下示例说明在高速缓存中压缩一个目录。
$ cachefspack -p /data/abc/bin |
$ cachefspack -i[v] cached-filename-or-directory |
指定希望查看有关已压缩文件的信息。
是详细选项。
指定要显示其信息的文件或目录的名称。
$ cachefspack -i doc_file cachefspack: file doc_file marked packed YES, packed YES |
在以下示例中,/data/abc 目录包含 bin 子目录。bin 子目录包含以下三个文件:big、medium 和 small。虽然指定要压缩 big 和 small 文件,但是未压缩它们。成功压缩了 medium 文件。
$ 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 . . . |
如果一起使用 -iv 选项,则可以获取有关是否已从高速缓存中清除指定的文件或目录的其他信息。例如:
$ 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 . . . |
此示例的最后一行说明,未从高速缓存中清除该目录的内容。
cachefspack 命令的一项功能是能够创建压缩列表。
压缩列表包含要在高速缓存中压缩的文件或目录。如果一个目录包含在压缩列表中,则也将压缩它的所有子目录和文件。
利用此功能,就可以节省必须指定要在高速缓存中压缩的每个单独文件的时间。
使用 vi 创建压缩列表文件。
压缩列表文件使用的格式与 filesync 命令的格式相同。有关更多信息,请参见 filesync(1)。
以下是压缩列表的两项功能:
可以将压缩列表中的文件标识为正则表达式而不是字面上的文件名,便可不必指定每个单独的文件名。
通过确保仅压缩您所拥有的那些文件,可以压缩共享目录中的文件。
有关使用这些功能的更多信息,请参见 cachefspack(1M)。
以下示例说明压缩列表文件的内容:
BASE /home/ignatz LIST plans LIST docs IGNORE *.ps |
使用 BASE 语句标识的路径是包含要压缩的项的目录。
两条 LIST 语句标识该目录中要压缩的特定文件。
IGNORE 语句标识文件类型 .ps(不希望压缩)。
此示例将 list.pkg 文件用作 cachefspack 命令的压缩列表。
$ cachefspack -f list.pkg |
可能需要从高速缓存中删除或解压缩文件。也许一些文件或目录的优先级高于其他文件或目录,因此需要解压缩不太关键的文件。例如,已完成一个项目,并归档了与该项目关联的文件。现在正从事一个新项目,因此使用一组新文件。
从高速缓存中解压缩文件或压缩列表。
$ cachefspack -u filename | -U cache-directory |
指定要解压缩的一个或多个文件。必须使用此选项指定一个文件名。
指定要在高速缓存中解压缩的文件或压缩列表的名称。
指定希望解压缩高速缓存中的所有文件。
有关更多信息,请参见 cachefspack(1M)。
以下示例说明从高速缓存中解压缩文件 /data/abc/bin/big。
$ cachefspack -u /data/abc/bin/big |
以下示例说明从高速缓存中解压缩三个文件。
$ cd /data/abc/bin/big $ cachefspack -u big small medium |
以下示例说明如何对压缩列表进行解压缩。压缩列表是一个包含目录(包含若干文件)路径的文件:
$ cachefspack -uf list.pkg |
以下示例使用 -U 选项指定对高速缓存目录中的所有文件进行解压缩。
$ cachefspack -U /local/mycache |
无法解压缩未挂载任何文件系统的高速缓存。使用 -U 选项时,如果指定的高速缓存不包含已挂载的文件系统,则显示与以下内容类似的输出:
$ cachefspack -U /local/mycache cachefspack: Could not unpack cache /local/mycache, no mounted filesystems in the cache. |
使用 cachefspack 命令时,可能会看到以下错误消息。
cachefspack: pathname - can't open directory: permission denied |
可能没有访问文件或目录的正确权限。
设置正确的权限。
cachefspack: pathname - can't open directory: no such file or directory |
指定的文件或目录可能不正确。
检查是否存在可能的键入错误。
cachefspack: pathname - can't open directory: stale NFS file handle |
在尝试访问文件或目录时,该文件或目录可能已从服务器中移走或删除。
验证服务器上的该文件或目录是否仍然可访问。
cachefspack: pathname - can't open directory: interrupted system call |
在发出命令时,可能无意中按了 Ctrl-C 组合键。
重新发出命令。
cachefspack: pathname - can't open directory: I/O error |
可能存在硬件问题。
检查硬件连接。
cachefspack: error opening dir |
指定的文件或目录可能不正确。在文件格式中 BASE 命令之后标识的路径可能是文件,而不是目录。指定的路径必须是目录。
检查是否存在可能的键入错误。检查在文件格式中 BASE 命令之后标识的路径。确保该路径标识的是目录而不是文件。
cachefspack: unable to get shared objects |
可执行文件可能已损坏,或者其格式无法识别。
替换可执行文件。
cachefspack: filename - can't pack file: permission denied |
可能没有访问文件或目录的正确权限。
设置正确的权限。
cachefspack: filename - can't pack file: no such file or directory |
指定的文件或目录可能不正确。
检查是否存在可能的键入错误。
cachefspack: filename- can't pack file: stale NFS file handle |
在尝试访问文件或目录时,该文件或目录可能已从服务器中移走或删除。
验证服务器上的该文件或目录是否仍然可访问。
cachefspack: filename- can't pack file: interrupted system call |
在发出命令时,可能无意中按了 Ctrl-C 组合键。
重新发出命令。
cachefspack: filename- can't pack file: I/O error |
可能存在硬件问题。
检查硬件连接。
cachefspack: filename- can't pack file: no space left on device. |
高速缓存的磁盘空间不足。
需要通过增加磁盘空间来增加高速缓存的大小。
cachefspack: filename - can't unpack file: permission denied |
可能没有访问文件或目录的正确权限。
设置正确的权限。
cachefspack: filename - can't unpack file: no such file or directory |
指定的文件或目录可能不正确。
检查是否存在可能的键入错误。
cachefspack: filename- can't unpack file: stale NFS file handle |
在尝试访问文件或目录时,该文件或目录可能已从服务器中移走或删除。
验证服务器上的该文件或目录是否仍然可访问。
cachefspack: filename- can't unpack file: interrupted system call |
在发出命令时,可能无意中按了 Ctrl-C 组合键。
重新发出命令。
cachefspack: filename- can't unpack file I/O error |
可能存在硬件问题。
检查硬件连接。
cachefspack: only one `d', `i', `p', or `u' option allowed |
在一个命令会话中指定了其中的多个选项。
为命令会话选择一个选项。
cachefspack: can't find environment variable. |
忘记设置对应的环境变量,以使其与配置文件中的 $ 匹配。
在正确的位置定义该环境变量。
cachefspack: skipping LIST command - no active base |
在配置文件中存在 LIST 命令,但该命令没有对应的 BASE 命令。
定义 BASE 命令。