Linux quote

linux中的quote磁碟配額可以有效的管理多用戶對磁碟操作的限制,由於linux是多用戶作業系統,有時候可能會出現幾個人同時在使用的情況,當其中一個人占用了大部分磁碟空間的時候其他人就會感覺到系統反應速度明顯變慢。為了解決這一問題所以我們要對每個用戶對磁碟的操作進行限制。註:此限制對root用戶不起作用。

基本介紹

  • 外文名:Linux quote
  • 系統:多用戶作業系統
  • 缺點:反應速度明顯變慢
  • 限制:對root用戶不起作用
Quota 相關的命令,啟用quota:quotaon,關閉quota:quotaoff,配額傳送警告:warnquota,編輯配額屬性:edquota,顯示配額信息:repquota,直接設定配額:setquota,

Quota 相關的命令

Quota 相關的幾個命令如下。

啟用quota:quotaon

[root@rhce /]# quotaon
Bad number of arguments.
quotaon: Usage:
quotaon [-guvp] [-F quotaformat] [-x state] -a
quotaon [-guvp] [-F quotaformat] [-x state] filesys ...
-a, --all turn quotas on for all filesystems
-f, --off turn quotas off
-u, --user operate on user quotas
-g, --group operate on group quotas
-p, --print-state print whether quotas are on or off
-x, --xfs-command=cmd perform XFS quota command
-F, --format=formatname operate on specific quota format
-v, --verbose print more messages
-h, --help display this help text and exit
-V, --version display version information andexit

關閉quota:quotaoff

[root@rhce /]# quotaoff
Bad number of arguments.
quotaoff: Usage:
quotaoff [-guvp] [-F quotaformat] [-x state] -a
quotaoff [-guvp] [-F quotaformat] [-x state] filesys ...
-a, --all turn quotas off for allfilesystems
-f, --off turn quotas off
-u, --user operate on user quotas
-g, --group operate on group quotas
-p, --print-state print whether quotas are on or off
-x, --xfs-command=cmd perform XFS quota command
-F, --format=formatname operate on specific quota format
-v, --verbose print more messages
-h, --help display this help text and exit
-V, --version display version information andexit

配額傳送警告:warnquota

[root@rhce /]# warnquota -h
warnquota: Usage:
warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile][-a adminsfile]
-u, --user warn users
-g, --group warn groups
-s, --human-readable send information in more humanfriendly units
-i, --no-autofs avoid autofs mountpoints
-d, --no-details do not send quota informationitself
-F, --format=formatnameuse quotafiles of specific format
-c, --config=config-file non-default config file
-q, --quota-tab=quotatab-file non-default quotatab
-a, --admins-file=admins-file non-default admins file
-h, --help display this help messageand exit
-v, --versiondisplay version informationand exit
[root@rhce /]#

編輯配額屬性:edquota

[root@rhce /]# edquota
edquota: Usage:
edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem]username ...
edquota [-rm] -g [-F formatname] [-pgroupname] [-f filesystem] groupname ...
edquota [-rm] [-u|g] [-F formatname] [-f filesystem] -t
edquota [-rm] [-u|g] [-F formatname] [-f filesystem] -Tusername|groupname ...
-u, --useredit user data
-g, --groupedit group data
-r, --remote edit remote quota (via RPC)
-m, --no-mixed-pathnames trim leading slashes from NFSv4mountpoints
-F, --format=formatname edit quotas of a specific format
-p, --prototype=namecopy data from a prototype user/group
--always-resolvealwaystry to resolve name, even if it is
composed only ofdigits
-f, --filesystem=filesystem edit data only on a specific filesystem
-t, --edit-period edit grace period
-T, --edit-times edit grace time of a user/group
-h, --helpdisplay this help text andexit
-V, --version display version informationand exit
[root@rhce /]#

顯示配額信息:repquota

[root@rhce /]# repquota -h
repquota: Utility for reporting quotas.
Usage:
repquota [-vugsi] [-c|C] [-t|n] [-Fquotaformat] (-a | mntpoint)
-v, --verbose display also users/groups withoutany usage
-u, --user display information aboutusers
-g, --group display information aboutgroups
-s, --human-readable show numbers in human friendly units(MB, GB, ...)
-t, --truncate-names truncate names to 8 characters
-p, --raw-grace print grace time in seconds sinceepoch
-n, --no-names do not translate uid/gid to name
-i, --no-autofs avoid autofs mountpoints
-c, --batch-translation translate big number of ids at once
-C, --no-batch-translation translate ids one by one
-F, --format=formatname report information for specific format
-h, --help display this help message andexit
-V, --version display version information andexit
檢查並修復quota 配置檔案:quotacheck
#quotacheck –cvug/tmp
[root@rhce ~]# quotacheck -h
Utility for checking and repairing quotafiles.
quotacheck [-gucbfinvdmMR] [-F<quota-format>] filesystem|-a
-u, --user check user files
-g, --group check group files
-c, --create-files create new quota files
-b, --backup create backups of old quota files
-f, --force force check even if quotas areenabled
-i, --interactiveinteractive mode
-n, --use-first-dquot use the first copy of duplicated structure
-v, --verbose print more information
-d, --debug print even more messages
-m, --no-remountdo not remount filesystem read-only
-M, --try-remounttry remounting filesystem read-only,
continue even if itfails
-R, --exclude-root exclude root when checking allfilesystems
-F, --format=formatname check quota files of specific format
-a, --all check all filesystems
-h, --help display this message and exit
-V, --version display version information andexit
[root@rhce ~]#
[root@rhce ~]# quotacheck -cvug /dave
quotacheck: Your kernel probably supportsjournaled quota but you are not using it. Consider switching to journaled quotato avoid running quotacheck after an unclean shutdown.
quotacheck: Scanning /dev/sdc1 [/dave] done
quotacheck: Cannot stat old user quotafile: No such file or directory
quotacheck: Cannot stat old group quotafile: No such file or directory
quotacheck: Cannot stat old user quotafile: No such file or directory
quotacheck: Cannot stat old group quota file:No such file or directory
quotacheck: Checked 3 directories and 2files
quotacheck: Old file not found.

直接設定配額:setquota

[root@rhce ~]# setquota -h
setquota: Usage:
setquota [-u|-g] [-rm] [-F quotaformat] <user|group>
<block-softlimit> <block-hardlimit> <inode-softlimit><inode-hardlimit> -a|<filesystem>...
setquota [-u|-g] [-rm] [-F quotaformat] <-p protouser|protogroup><user|group> -a|<filesystem>...
setquota [-u|-g] [-rm] [-F quotaformat] -b [-c] -a|<filesystem>...
setquota [-u|-g] [-F quotaformat] -t <blockgrace><inodegrace> -a|<filesystem>...
setquota [-u|-g] [-F quotaformat] <user|group> -T<blockgrace> <inodegrace> -a|<filesystem>...
-u, --user set limits for user
-g, --group set limits for group
-a, --all set limits for allfilesystems
--always-resolve always tryto resolve name, even if is
composed only ofdigits
-F, --format=formatname operate on specific quota format
-p, --prototype=protoname copy limits from user/group
-b, --batch read limits from standard input
-c, --continue-batch continue in input processing in case ofan error
-r, --remote set remote quota (via RPC)
-m, --no-mixed-pathnames trim leading slashes from NFSv4mountpoints
-t, --edit-periodedit grace period
-T, --edit-times edit grace times for user/group
-h, --help display this help text andexit
-V, --version display version information andexit

熱門詞條

聯絡我們