你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux 用户 Quota 配置 说明

[日期:2013-08-11] 来源:CSDN  作者:tianlesoftware [字体:大 中 小]

2.7 更改宽限时间

 

通过repquota命令,可以看到block和inode的宽限时间默认都是7天。

[root@rhce ~]# repquota /dave

*** Report for user quotas on device/dev/sdc1

Block grace time: 7days;Inode grace time: 7days

 

这个时间,我们可以使用edquota 来修改。

 

[root@rhce ~]# edquota -h

edquota: Usage:

edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem]username ...

edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystem]groupname ...

edquota [-rm] [-u|g] [-F formatname] [-f filesystem] -t

edquota [-rm] [-u|g] [-F formatname] [-f filesystem] -Tusername|groupname ...

 

-u, --user edit user data

-g, --group edit 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=name copy data from a prototype user/group

--always-resolve alwaystry to resolve name, even if it is

composed only of digits

-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, --help display this help text andexit

-V, --version display version informationand exit

 

2.7.1 按用户来设置宽限时间

--修改用户dave01的宽限时间:

 

[root@rhce ~]# edquota-T dave01

Times to enforce softlimit for user dave01(uid 503):

Time units may be: days, hours, minutes, orseconds

Filesystem block grace inodegrace

/dev/sdc1 601938seconds unset

~

这是默认值:

 

[root@rhce ~]# edquota -T dave01

Times to enforce softlimit for user dave01(uid 503):

Time units may be: days,hours, minutes, or seconds

Filesystem block grace inodegrace

/dev/sdc1 10days unset

 

我们改成10天。 上面有时间的单位。

 

--查看报告显示:

[root@rhce ~]# repquota /dave

*** Report for user quotas on device/dev/sdc1

Block grace time: 7days; Inode grace time:7days

Block limits File limits

User used soft hard grace used soft hard grace

----------------------------------------------------------------------

root -- 141432 0 0 3 0 0

dave01 +- 20476 10240 20480 10days 2 0 0

dave02 -+ 4 0 0 30 20 30 6days

 

 

[root@rhce ~]# edquota -T dave02

Times to enforce softlimit for user dave02(uid 504):

Time units may be: days, hours, minutes, orseconds

Filesystem block grace inodegrace

/dev/sdc1 unset 12days

~

[root@rhce ~]# repquota/dave

*** Report for user quotas on device/dev/sdc1

Block grace time: 7days; Inode grace time:7days

Block limits File limits

User used soft hard grace used soft hard grace

----------------------------------------------------------------------

root -- 141432 0 0 3 0 0

dave01 +- 20476 10240 20480 9days 2 0 0

dave02 -+ 4 0 0 30 20 30 12days

 

 

2.7.2 按组来设置宽限时间

 

我们的dave02 用户对应的组是grp02.

 

-Tg 争对组

T 争对用户

 

--默认值:

[root@rhce ~]# edquota -Tg grp02

Times to enforce softlimit for group grp02(gid 504):

Time units may be: days,hours, minutes, or seconds

Filesystem block grace inodegrace

/dev/sdc1 unset unset

 

 

 

--修改:

[root@rhce ~]# edquota -Tg grp02

Times to enforce softlimit for group grp02(gid 504):

Time units may be: days, hours, minutes, orseconds

Filesystem block grace inodegrace

/dev/sdc1 unset 10days

 

~

 

但是这里我们一旦保存之后,我们的修改就又还原了。

 

如果我们想修改组的宽限时间,就必须先设置组的soft和hard limit。 只有这2个属性设置以后,才可以设置宽限时间。

 

[root@rhce dave]# edquota-g grp02

Disk quotas for group grp02 (gid 504):

Filesystem blocks soft hard inodes soft hard

/dev/sdc1 4 0 0 30 20 30

 

这是完以后,就可以设置组的宽限时间了。

 

 

 

 

2.8 关闭配额

[root@rhce dave]# quotaoff -a

 

--关闭quota之后,在清空/etc/fstab 文件中有关配额的限制。

 

最后remount 磁盘。

linux
相关资讯       Linux Quota 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款