[root@localhost mnt]# grep CONFIG_QUOTA /boot/config-2.6.32-431.el6.x86_64 CONFIG_QUOTA=y CONFIG_QUOTA_NETLINK_INTERFACE=y # CONFIG_QUOTA_DEBUG is not set CONFIG_QUOTA_TREE=y CONFIG_QUOTACTL=y
如有以上两条则说明支持,另外quota是针对用户去限制其可使用的block和inode,所以应该是一个基于文件系统的配置,所以我们要在文件系统中开启quota功能,针对已经挂载过的文件系统我们可以使用 mount -o remount,usrquota,grpquota,default /mnt
来重新挂载激活(mnt只是个举例,实际中先df 命令查看当前挂载信息,在选择要开启的文件系统),也可以写在/etc/fstab文件中umount 后再mount -a 或重启系统
[root@localhost mnt]# mount /dev/mapper/VolGroup-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) /dev/mapper/vgxiemx-lv1 on /mnt type ext3 (rw)
[root@localhost mnt]# mount -o remount,grpquota,usrquota,defaults /mnt
[root@localhost mnt]# mount /dev/mapper/VolGroup-lv_root on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) /dev/mapper/vgxiemx-lv1 on /mnt type ext3 (rw,usrquota,grpquota) [root@localhost mnt]#
[root@localhost mnt]# quotacheck -avug quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. quotacheck: Scanning /dev/mapper/vgxiemx-lv1 [/mnt] done quotacheck: Checked 3 directories and 6 files [root@localhost mnt]# ls aquota.group aquota.user lost+found
edquota -t ——默认7天 Grace period before enforcing soft limits for users: Time units may be:days, hours, minutes, or seconds Filesystem Block grace period Inode grace period /dev/mapper/vgxiemx-lv17days7days
5.查询所有用户的磁盘配额情况,用户也可用quota查询当前用户的quota信息
1 2 3 4 5 6 7 8 9 10
repquota -a
[root@localhost mnt]# repquota -a *** Report for user quotas on device /dev/mapper/vgxiemx-lv1 Block grace time: 7days; Inode grace time: 7days Block limits File limits User used soft hard grace used soft hard grace ------------------------------------------------------------------------------------------- root -- 956592 0 0 6 0 0 testuser ++ 100 10 100 6days 100 10 100 6days