Quota mini-HOWTO
Ralf van Dooren r.vdooren@snow.nl
v0.5, 2003-08-09
??????? ?? ???????: (c) ???? ?????
Preamble: This document is written by Ralf van Dooren
(r.vdooren@snow.nl). Original text and setup of this document is
copyleft-ed by Albert M.C. Tam, many thanks to him for this initial
mini-HOWTO. This document is licensed under the GNU Free
Documentation License. Permission to use, copy, distribute this
document for non-commercial purposes is hereby granted, provided
that the author's / editor's name and this notice appear in all
copies and/or supporting documents; that this document is not
modified. This document is distributed in hope that it will be
useful, but WITHOUT ANY WARRANTY, either expressed or implied.
While every effort has been taken to ensure the accuracy of the
information documented herein, the author / editor / maintainer
assumes NO RESPONSIBILITY for errors, or for damages results for
the use of the information documented herein.
???? ???????? ????????? ?????? ? ??????? ? ??????? Linux,
????????? ???? ??? ????????????? ? ????? ? ?????????????
?????????????? ?????? ?????????? ???????. ???????? ???????????? ???
?????????????, ?????????? ? ?????? 2.x (????????? ?????? ????, ??
??????? ??????????? ?????? ? ??????? -- 2.4.21).
?????????? ?????????? ? ????????? ???, ?? ????? r.vdooren at snow.nl. ? ????
???????????.
???????????? ????????? ???????? ??????????? ?? ???? ??????????
???????? ????????: ????? ????????? ????????????, ???????? ?????
??????? ???????????? ??? ??????, ? ????? ?????? ?????, ?????????
???????????? ??? ??????.
???? ???????????? ??????????? ? ??????????? ?????????
????????????, ?????????? ????????????. ??? ????? ??????????? ???
??????????? ?????? ??? ???????? ???????????? ???????. ?????
??????????? ?? ?????? ???????????? ? ???????? ???????. ???? ???????
????? ????? ???????? ???????, ????????? ????????????, ????????????
?????? ???? ????????? ?? ?????? ?? ???. ??? ?????????? ?
????????????? ?????? ? ??????? ?????????? ??????? ????? ??????.
? ????????? ????? ? ?????????? ????????? ???????????? ????
??????? ???????????? ?????????. ?????? ?????????? ??? ??????
???????? ?????????. ??????? ???????? ??? ? ??????, ?? ???? ??????? ?
???????????? ??????. ?????? ???????? ????????? ????????? ? ?????? ?
????? ????????? ????????????. ????????? ???? ????? ???????? ???
?? ??????? ? ????, ??? ???????? ??? ??????????. ?? ?????? ???????
????????? ????? ? ?????? linuxquota. ???? ? ??? ??? ??????????? ??
??? ????????????, ??, ???? ?????, ??? ????? ????? ????? ??????????
??, ? ???????? ? ???. ?????? ???????? ???, ???? ? ??? ????????
???????. ? ?????????? ????? ???????? ? ???? ???????? ?????
????????????? Linux ? ?? ???????????? ????????????.
???????? ??? ???? 2.x ???????? ?? ????? http://www.kernel.org>.
??????????, ??? ?????????? ??????? ??????????? ????????? ? ???
????????. ???? ? ??? ?????? ?????? ??????? tar, ?? ?????? ?????????
?????? ???? .bz2.
?????????????? ????:
cd /usr/src
tar jxvf /path/to/linux-2.4.21-tar.bz2 - ??? ????, ??????? bzip2 -
tar zxvf /path/to/linux-2.4.21-tar.gz - ??? ????, ??????? gzip -
ln -s /usr/src/linux-2.4.21 /usr/src/linux
? ??????????? ?? ????????????? ???????????? Linux ? ??? ?????
???? ??? ??????????? ?? ????????????. ??????????? ???????????
???????????? ??????? ???????????????, ? ?????? ?????? ??
???????? ?? SourceForge. ???????? ???????? ???????
????????? ?? ?????? http://www.sourceforge.net/projects/linuxquota.
>
????????? ???? ???? :
ftp://atrey.karlin.mff.cuni.cz/pub/local/jack/quota/.
???????? ?????? ?????? ???? ? ????????? ????. ????????? ????
???? ???????? 'patch'. ???? ??? ?????? ???? ???? ????????? ??????,
??????????? ???????????? ?? ? ?????? ???????.
?? ?????? ???????????? ???? ?????? ( ? ???????, ??? ???????????
????? ????????? ? /tmp/quota/, ? ???? ??????????????? ? ???????
/usr/src/linux) :
#!/bin/sh
gunzip /tmp/quota/*.gz
cd /usr/src/linux
COUNT=`ls -1 /tmp/quota/*.diff | wc -l`
for I in `seq 1 $COUNT`
do
patch -p1 < /tmp/quota/quota-2.4.21-$I-*.diff
done
?????????????????? ???? ???? ? ???????? ????????? ????.
? ??????? `make menuconfig` ??? `make xconfig` ??????? ????????
????????? ???? ? ???? Filesystems. ?????, ??? ?????????????,
??????? ?????????????? ?????????, ???????? ????????? 32-??????
UID.
????????? ???????????? ? ????????????? ????. ?????????, ??? ???
???????? ????? ??????? ????? ????, ?????????????? ?????.
??? ????, ????? ???????????? ??? ??????????? ????? ??????? ????, ???, ????????,
????? ????? ????????? ????? ????? ?????? ?????? ? ???????. ??? ????? ?????????
?? ???????????? ???? ??????.
????? ???????? ?????????:
$ gzip -dc <downloaded file> | tar xvf
$ cd quota-tools (??????? ???????, ? ??????? ????????? ???????)
$ ./configure
$ make
$ su
# make install
??? ??????:
# ????????? ? ???????????? ?????.
if [ -x /usr/sbin/quotacheck ]
then
echo "Checking quotas. This may take some time."
/usr/sbin/quotacheck -avug
echo " Done."
fi
if [ -x /usr/sbin/quotaon ]
then
echo "Turning on quota."
/usr/sbin/quotaon -avug
fi
??????? ??????? ??????: ??????????? ????? ????? ????, ???
???????????? ??? ???????? ??????? ?? ????? /etc/fstab, ?????
????? ???????? ?? ?????. ? ?????????? ???????? ????? ????? ?????
???????????? ???????? ?????? ? ????????????????? ???????.
???????, ?? ??????? ??? ?? ????????? ????????????, ????????
???????? ???:
/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /usr ext2 defaults 1 1
??? ????, ????? ???????? ????????? ???????????? ?? ????????
???????, ???????? ???? "usrquota" ? ????????? ????, ??????????
?????"defaults" (?? ????????????? ??????????? ? man fstab).
/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /usr ext2 defaults,usrquota 1 1
???????? ???? "usrquota" ?? "grpquota", ???? ??? ????? ?????????
???? ??? ?????.
/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /usr ext2 defaults,grpquota 1 1
????? ????????? ???????????? ????????????? ? ????? ?? ?????
???????? ???????? ??????????.
/dev/hda1 / ext2 defaults 1 1
/dev/hda2 /usr ext2 defaults,usrquota,grpquota 1 1
??? ????????? ??????? ???????????? ????? ????????????? ???????,
????? ????????? ????????? ??????? ? ????. ?????????? ???? ?
?????????? ???? ? ?????????? ?????????? ????????????????? ???????.
??? ?????? ??????? quotacheck ??????????? ??????????? ????? ???
??????????? ??? ?????? ????????????.
??????? ????????? ????????? quotacheck. ????????, ??? ?
??????. ??? ????? ???????? ????????? ?????? ? ???? crontab:
0 3 * * 0 /sbin/quotacheck -avug
??? ???????? ??????????? ? ??????? ??????? edquota (?? ?????????
??????????? ??????????? ? ??????? `man edquota`).
?????????? ??????. ? ???? ??????? ???? ???????????? ? ??????
bob. ??????? "edquota -u bob" ???????? ???????? vi (??? ?????
??????, ????????? ? ?????????? ????????? $EDITOR) ???
?????????????? ???? ???????????? bob ?? ?????? ???????, ??? ????????
????????? ????????????:
Quotas for user bob:
/dev/hda3: blocks in use: 2594, limits (soft = 5000, hard = 6500)
inodes in use: 356, limits (soft = 1000, hard = 1500)
"blocks in use" -- ??? ????? ?????????? ?????? (? ??????????)
?????????????? ????????????? ?? ???????.
"inodes in use" -- ????? ????? ?????????????? ????????????? ??
??????? ?-???.
?????? ???????? ? ??? ??????? ?????? games. ??????? "edquota -g
games" ????? ??????? ??? ???????? vi ??? ?????????????? ????? ???
?????? games:
Quotas for group games:
/dev/hda4: blocks in use: 5799, limits (soft = 8000, hard = 10000)
inodes in use: 1454, limits (soft = 3000, hard = 4000)
????? ?????? ?????????? ?????, ??????, ??? ??? ?????????????,
?????? ????????????? ????? ??? ???????????? bob, ? ????????????
??????? ?????????? bob'?, ????? ???? ???????:
edquota -p bob `awk -F: '$3 > 499 {print $1}' /etc/passwd`
????? ? ???????, ??? ?? ??????????? ????????? ???????????????
csh, ? ???????????????? UID ?????????? ?? ???????? 500.
? ?????????? ? edquota ?????????? ??? ???????, ? ???????? ???
????? ?????????????: "?????? ?????", "??????? ?????" ? "??????
????????" (Soft Limit, Hard Limit, Grace Period).
?????? ????? ?????? ???????????? ???????? ?????????????
???????????? ???????? ??????? ??? ????????????. ? ?????????? ?
???????? ???????? ???????? ??? ????????? ?????, ?? ???????
???????????? ???????? ?????????????? ? ?????????? ????? ?????.
??????? ????? ???????? ?????? ??? ???????? ??????? ????????. ??
?????? ?????????? ???????? ????????????? ???????????? ????????
??????? ?????????????.
????????????? ? ??????? ??????? "edquota -t", ?????? ???????? -- ??? ??????
???????, ????? ???????? ?????? ????? ????????????? ???????????? ????????? ????????????
???????? ??????? ??? ????????????. ???????? ??????? ????? ????????? ? ????????,
???????, ?????, ????, ??????? ? ??????? [ sec(onds), min(utes), hour(s), day(s),
week(s), month(s) ]. ???, ??? ?? ??????? ? ?????????? ?????????? ??????? "edquota
-t":
Time units may be: days, hours, minutes, or seconds
Grace period before enforcing soft limits for users:
/dev/hda2: block grace period: 0 days, file grace period: 0 days
???????? ????? ??????, ?????????? "0 days" ?? ????? ??????????
??? ?????????? ???????. ????? ? ??????????? 7 ???? (??? 1
??????).
Quotacheck ???????????? ??? ???????????? ???????? ??????? ??
??????? ?? ????????????? ? ?????????? ????? "aquota.user",
??????????? ?????? ?? ?????????????? ?????????????? ????????????.
? ?????????? ????????? quotacheck ??? ???????? ? ???????????? ???
??????? ??? cron (??????, ?????? ???????).
Repquota ?????????? ????????? ????? ?? ?????? ?? ????????
???????. ???? ???????? ?????? ?????? repquota:
# repquota -a
Block limits File limits
User used soft hard grace used soft hard grace
root -- 175419 0 0 14679 0 0
bin -- 18000 0 0 735 0 0
uucp -- 729 0 0 23 0 0
man -- 57 0 0 10 0 0
user1 -- 13046 15360 19200 806 1500 2250
user2 -- 2838 5120 6400 377 1000 1500
??????? quotaon ???????????? ??? ????????? ??????? ????, ?????
??? quotaoff ??? ?? ??????????. ?????????? ??? ????? ???????. ???
??????????? ??? ?????? ? ?????????? ?????? ???????.
Copyright (c) 2003, Ralf van Dooren
????????? ?? ??????? ????????