NAME
quotacheck - 扫描文件系统,创建,检测并修补配额文件
总览(SYNOPSIS)
quotacheck [ -agucfinvdFR ] filesystem
描述(DESCRIPTION)
quotacheck 察看每一个文件系统,建立当前磁盘使用情况表,并将此表与配额文件中相应内容比较(如果使用了选项 -c , 这一步将省略).如果发现任何不一致,同时更新配额文件和当前不正确的系统配额拷贝(只有当选择使用配额的文件系统时,才更新后者).在缺省状态下,只选择用户配额.
quotacheck 要求每个被检测的文件系统在其根目录中都有名为 aquota.user 和 aquota.group 的配额文件.如果上述文件不存在, quotacheck 将创建它(们).
quotacheck 通常在系统启动的时候由位于 /etc/init.d 的初始化脚本在 quotaon(8) 建立磁盘配额之前运行.
强烈建议在运行 quotacheck 之前关掉配额,卸载文件系统或者将其设为只读模式,否则会出现配额损坏.
quotacheck 在开始扫描之前,会尝试以只读模式装配各文件系统. 当扫描完成时,它会以读写模式重新装配文件系统.你可以用-F选项使 quotacheck 在尝试以只读模式重新装配文件系统失败之后继续运行.
完成扫描所需要的时间与磁盘的使用程度成正比.
选项(OPTIONS)
- -v
- quotacheck 在运行时报告其每一项操作.在缺省状态下不报告.
- -d
- 进入调试状态.这会产生许多用于调试程序的信息.输出的信息非常详尽,而扫描速度会减慢.
- -a
- 如果用它取代任何文件系统的名字, quotacheck 将检测所有在 /etc/mtab 中列为可读写的文件系统的配额.在缺省状态下,只有在 /etc/mtab 中被列为配额的文件系统才会被检测.
- -u
- 只检测在 /etc/mtab 列出或指定的文件系统中的用户配额.这是缺省状态下采取的行动.
- -g
- 只检测在 /etc/mtab 中列出或制定的文件系统中的组配额
- -c
- 不读已经存在的配额文件.执行一次新的扫描,并且把结果保存到磁盘上.
- -f
- 强制检测所有使用配额的文件系统.不推荐使用该选项,因为其产生的配额文件可能会不同步.
- -F
- 强制在可读写状态下检测文件系统.当使用该选项时,请先确定在对文件系统进行扫描的时候,没有进程需要对该文件系统写入数据.
- -R
- 当与 -a 一起使用时,检测除根(root)文件系统外的其他所有文件系统.
- -i
- 交互模式.在缺省状态下, quotacheck 在发现错误后即退出.在交互模式下,用户会被问取建议. 参考选项 -n.
- -n
- 有时候对同一个ID会找到多个结果. 通常遇到这种情况 quotacheck 就终止运行.该选项强制使用第一个结果(该选项在交互模式下同样有效).
注意 (NOTE)
quotacheck 应该只能由超级用户执行.因为未授权用户通常不能读一个给定文件系统上的所有目录.
参见(SEE ALSO)
quota(1), quotactl(2), fstab(5), quotaon(8), repquota(8), convertquota(8), setquota(8), edquota(8), fsck(8), efsck(8), e2fsck(8), xfsck(8)
#p#
NAME
quotacheck - scan a filesystem for disk usage, create, check and repair quota files
SYNOPSIS
quotacheck [ -gubcfinvdMmR ] [ -F quota-format ] -a | filesystem
DESCRIPTION
quotacheck examines each filesystem, builds a table of current disk usage, and compares this table against that recorded in the disk quota file for the filesystem (this step is ommitted if option -c is specified). If any inconsistencies are detected, both the quota file and the current system copy of the incorrect quotas are updated (the latter only occurs if an active filesystem is checked which is not advised). By default, only user quotas are checked. quotacheck expects each filesystem to be checked to have quota files named [a]quota.user and [a]quota.group located at the root of the associated filesystem. If a file is not present, quotacheck will create it.
If the quota file is corrupted, quotacheck tries to save as much data as possible. Rescuing data may need user intervention. With no additional options quotacheck will simply exit in such a situation. When in interactive mode (option -i) , the user is asked for advice. Advice can also be provided from command line (see option -n) , which is useful when quotacheck is run automatically (ie. from script) and failure is unacceptable.
quotacheck should be run each time the system boots and mounts non-valid filesystems. This is most likely to happen after a system crash.
It is strongly recommended to run quotacheck with quotas turned off for the filesystem. Otherwise, possible damage or loss to data in the quota files can result. It is also unwise to run quotacheck on a live filesystem as actual usage may change during the scan. To prevent this, quotacheck tries to remount the filesystem read-only before starting the scan. After the scan is done it remounts the filesystem read-write. You can disable this with option -m. You can also make quotacheck ignore the failure to remount the filesystem read-only with option -M.
OPTIONS
- -b
- Forces quotacheck to make backups of the quota file before writing the new data.
- -v
- quotacheck reports its operation as it progresses. Normally it operates silently.
- -d
- Enable debugging mode. It will result in a lot of information which can be used in debugging the program. The output is very verbose and the scan will be slow.
- -u
- Only user quotas listed in /etc/mtab or on the filesystems specified are to be checked. This is the default action.
- -g
- Only group quotas listed in /etc/mtab or on the filesystems specified are to be checked.
- -c
- Don't read existing quota files. Just perform a new scan and save it to disk. quotacheck also skips scanning of old quota files when they are not found.
- -f
- Forces checking and writing of new quota files on filesystems with quotas enabled. This is not recommended as the created quota files may be out of sync.
- -M
- This flag forces checking of filesystem in read-write mode if a remount fails. Do this only when you are sure no process will write to a filesystem while scanning.
- -m
- Don't try to remount filesystem read-only. See comment with option -M.
- -i
- Interactive mode. By default quotacheck exits when it finds an error. In interactive mode user is asked for input instead. See option -n.
- -n
- If the quota files become corrupted, it is possible for duplicate entries for a single user or group ID to exist. Normally in this case, quotacheck exits or asks user for input. When this option is set, the first entry found is always used (this option works in interactive mode too).
- -F format-name
- Check and fix quota files of specified format (ie. don't perform format auto-detection). This is recommended as detection might not work well on corrupted quota files. Possible format names are: vfsold (version 1 quota), vfsv0 (version 2 quota), rpc (quota over NFS), xfs (quota on XFS filesystem)
- -a
- Check all mounted non-NFS filesystems in /etc/mtab
- -R
- When used together with the -a option, all filesystems except for the root filesystem are checked for quotas.
NOTE
quotacheck should only be run by super-user. Non-privileged users are presumably not allowed to read all the directories on the given filesystem.
SEE ALSO
quota(1), quotactl(2), fstab(5), quotaon(8), repquota(8), convertquota(8), setquota(8), edquota(8), fsck(8), efsck(8), e2fsck(8), xfsck(8)