# # /etc/fstab # Created by anaconda on Mon Apr 17 21:42:08 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/cl-root/ xfs defaults 00 UUID=4e9e73e3-0ff0-4ac5-865f-7ab4975be268 /boot xfs defaults 00 /dev/mapper/cl-swap swap swap defaults 00 UUID=0dc3603b-bb2b-4ecc-b7bb-f2ea8078ce9d /mnt/data ext4 defualts,usrquota,grpquota 00
执行
mount -a
然后 mount 查看最后一行,如果有如下内容则表示成功。
[root@localhost mnt]# mount | tail -1 /dev/sdc7 on /mnt/data type ext4 (rw,relatime,seclabel,quota,usrquota,grpquota,data=ordered)
检测磁盘配额并创建配额文件
[root@localhost mnt]# quotacheck --help Utility for checking and repairing quota files. 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 are enabled -i, --interactive interactive 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-remount do not remount filesystem read-only -M, --try-remount try remounting filesystem read-only, continue even if it fails -R, --exclude-root exclude root when checking all filesystems -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 and exit
Bugs to jack@suse.cz
使用quotacheck -ugcv 需要操作的设备 来创建配额文件
[root@localhost mnt]# quotacheck -ugcv /dev/sdc7 quotacheck: Your kernel probably supports journaled quota but you are notusingit. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. quotacheck: Scanning /dev/sdc7 [/mnt/data] done quotacheck: Checked 2 directories and2 files [root@localhost mnt]# ls /mnt/data aquota.group aquota.user lost+found [root@localhost mnt]#
如果挂载的目录有aquota.group和aquota.user 则表示成功。
创建用户
[root@localhost mnt]# useradd zhangsan [root@localhost mnt]# passwd zhangsan Changing password for user zhangsan. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: all authentication tokens updated successfully.
创建用户配额
[root@localhost mnt]# edquota -u zhangsan Disk quotas for user zhangsan (uid 1010): Filesystem blocks soft hard inodes soft hard /dev/sdc7 0 0 0 0 0 0
前三列 blocks 针对块 后三列 inodes 针对文件数 soft 是软现在 hard 是硬限制