

yum install quota
nano /etc/fstab поставить доп парметры для монтирования usquote и grquote
/dev/sdb1/ /mnt/hard_drive auto rw,user,auto,usrquota,grtquota 0 2
mount /dev/sdb1
quotaoff /mnt/hard_drive проверим есть ли квоты — команда отключает квоты
quotacheck -cug /mnt/hard_drive создаем квоту на монтируемый раздел
появляются файлы aquota.group aquota.user их можно редактировать
edquota -u andrey
Disk quotas for user andrey (uid 1000):
Filesystem blocks soft hard inodes soft hard
/dev/sdb1 0 0 0 0 0 0
Disk quotas for user andrey (uid 1000):
Filesystem blocks soft hard inodes soft hard
/dev/sdb1 0 0 0 0 0 5
ставим 5 — пользователь может создать 5 папок/файлов
sudo edquota -t можно изменить время длтельности квоты
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/sdb1 7days 7days
включам котирование
quotaon /mnt/hard_drive/
[root@cent1 hard_drive]# su andrey
[andrey@cent1 hard_drive]$ touch 1.txt
touch: cannot touch ‘1.txt’: Permission denied
[andrey@cent1 hard_drive]$ su root
Password:
[root@cent1 hard_drive]# chown andrey:root /mnt/hard_drive/ меняем владельца для этой папки
[root@cent1 hard_drive]# su andrey
[andrey@cent1 hard_drive]$ touch 1.txt
[andrey@cent1 hard_drive]$ touch 2.txt
[andrey@cent1 hard_drive]$ touch 3.txt
[andrey@cent1 hard_drive]$ touch 4.txt
[andrey@cent1 hard_drive]$ touch 5.txt
sdb1: write failed, user file limit reached.
touch: cannot touch ‘5.txt’: Disk quota exceeded видим что квота достигнута
[andrey@cent1 hard_drive]$ edquota -u andrey
Disk quotas for user andrey (uid 1000):
Filesystem blocks soft hard inodes soft hard
/dev/sdb1 4 0 0 5 0 5
~
repquota /mnt/hard_drive/
*** Report for user quotas on device /dev/sdb1
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
root — 48 0 0 3 0 0
andrey — 4 0 0 5 0 5