Ubuntu 启用磁盘配额 quota

quota 可以为用户或用户组设置磁盘配额. 限制用户或用户组能使用的磁盘大小.

1. 安装 quota :

sudo apt-get install quota

2. 编辑 /etc/fstab 文件,启用 quota

vi  /etc/fstab

添加 usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 到需要启用 quota 的分区. 比如 /:

# /etc/fstab: static file system information.
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=7cf8dc2b-2541-4684-8931-844b6bd01e9c /               ext4    errors=remount-ro,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 0       1
# /boot was on /dev/sda1 during installation
UUID=4541b27d-84d6-4f70-9077-7cb9308634b6 /boot           ext4    defaults        0       2
# swap was on /dev/sda3 during installation
UUID=ccae84a6-7423-4e60-9448-0cf05a053fbc none            swap    sw              0       0

3. 重新挂载分区:

touch /aquota.user /aquota.group
chmod 600 /aquota.*
mount -o remount /

4. 启用 quota :

quotacheck -avugmc
quotaon -avug




原文来自 Blog by Neil, post Ubuntu 启用磁盘配额 quota 转载请注明出处。本站保留一切权力