Sunteți pe pagina 1din 5

Configuration of disk usage quotas on Linux - Perform the following as root:

1. Edit file /etc/fstab to add qualifier "usrquota" or "grpquota" to the partition. The following file sstem
mounting options !an "e spe!ified in /etc/fstab: grpquota# noquota# quota and usrquota. $These options are
also a!!epted " the mount !ommand "ut ignored.% The filesstem when mounted will show up in the file
/etc/mtab# the list of all !urrentl mounted filesstems.%
o To ena"le user quota support on a file sstem# add "usrquota" to the fourth field !ontaining the word
"defaults".
...
/dev/hda2 /home ext3 defaults,usrquota 1 1
...

o &epla!e "usrquota" with "grpquota"# should ou need group quota support on a file sstem.
...
/dev/hda2 /home ext3 defaults,grpquota 1 1
...

o 'eed "oth user quota and group quota support on a file sstem(
...
/dev/hda2 /home ext3 defaults,usrquota,grpquota 1 1
...
o This ena"les user and group quotas support on the /home file sstem.
). touch /partition/aquota.user
where the partition might "e /home or some partition defined in /etc/fstab.
then
chmod 600 /partition/aquota.user
The file should "e owned " root. *uotas ma also "e set for groups " using the file aquota.group
*uota file names:
o *uota +ersion ) $Linux ).,-).. kernel: &ed /at 0.11-2-3#4C 1-5%: aquota.user, aquota.group
o *uota +ersion 1 $Linux ).) kernel: &ed /at .# 0.6%: quota.user, quota.group
The files !an "e !on7erted-upgraded using the convertquota !ommand.
5. &e-"oot or re-mount file partition with quotas.
o &e-"oot: shutdown -r now
o &e-mount partition: mount -o remount /partition
8fter re-"ooting or re-mounting the file sstem# the partition will show up in the list of mounted filesstems as
ha7ing quotas. Che!k /etc/mtab:
...
/dev/hda / ext3 rw,usrquota 0 0
...

,. quotachec! -vgum /partition
or
quotachec! -vguma
o 4or example $Linux kernel ).,1: &ed /at 0.11# 4edora%: quotachec! -vguma
quotachec!" #$%&'&( - )uotaf*le //aquota.user was probabl+
truncated. ...
quotachec!" ,cann*ng /dev/hda -/. done
quotachec!" /hec!ed 0001 d*rector*es and 120312 f*les

o 4or example $Linux kernel ).): &ed /at .-0.6%: quotachec! -v /dev/hda6
9stem response:
,cann*ng /dev/hda6 -/home. done
/hec!ed 333 d*rector*es and 3136 f*les
4s*ng quotaf*le /home/quota.user

:. *uota!he!k is used to s!an a file sstem for disk usages# and updates the quota re!ord file "quota.user-aquota.user"
to the most re!ent state. ;t is re!ommended thet quota!he!k "e run at "ootup $part of &edhat default installation%
.. <an page: quota!he!k - s!an a filesstem for disk usage# !reate# !he!k and repair quota files
0. quotaon -av
9stem &esponse: /dev/hda6" user quotas turned on
quotaon - ena"le disk quotas on a file sstem.
quotaoff - turn off disk quotas for a file sstem.
<an page: quotaon - turn filesstem quotas on and off
2. edquota -u user_id
Edit dire!tl using 7i editor !ommands. $9ee "elow for more info.%
4or example: edquota -u user1
o 9stem &esponse $&/ 01%:
5*s! quotas for user user1 6u*d 017"
8*les+stem bloc!s soft hard *nodes soft hard
/dev/hda 1033 0 0 120 0 0

"lo!ks: 1k "lo!ks
inodes: 'um"er of entries in dire!tor file
soft: <ax num"er of "lo!ks-inodes user ma ha7e on partition "efore warning is issued and gra!e
persiod !ountdown "egins.
;f set to "6" $=ero% then no limit is enfor!ed.
hard: <ax num"er of "lo!ks-inodes user ma ha7e on partition.
;f set to "6" $=ero% then no limit is enfor!ed.
o 9stem &esponse $&/ .%:
)uotas for user user1"
/dev/sdb6" bloc!s *n use" 6, l*m*ts 6soft 9 0, hard 9 07
*nodes *n use" 0, l*m*ts 6soft 9 0, hard 9 07

9omething failed if ou get the response:
/dev/sdb6" bloc!s *n use" 0, l*m*ts 6soft 9 0, hard 9 07
*nodes *n use" 0, l*m*ts 6soft 9 0, hard 9 07

Edit limits:
)uotas for user user1"
/dev/hda6" bloc!s *n use" 002, l*m*ts 6soft 9 0000, hard 9 0007
*nodes *n use" 21, l*m*ts 6soft 9 10000, hard 9 110007

3. ;f editing group quotas: edquota -g group_name
16. <an page: edquota - edit user quotas
11. List quotas:
quota -u user_id
4or example: quota -u user1
9stem response:
5*s! quotas for user user1 6u*d 017"
8*les+stem bloc!s quota l*m*t grace f*les quota l*m*t grace
/dev/hda6 002 0000 000 21 10000 11000

;f this does not respond similar to the a"o7e# then restart the !omputer: shutdown -r now
<an page: quota - displa disk usage and limits
Quota Reports:
&eport on all users o7er quota limits: quota -q
*uota summar report: repquota -a
::: %eport for user quotas on dev*ce /dev/hda
;loc! grace t*me" 2da+s< 'node grace t*me" 2da+s
;loc! l*m*ts 8*le l*m*ts
4ser used soft hard grace used soft hard grace
----------------------------------------------------------------------
root -- 333200 0 0 11102 0 0
b*n -- 1633 0 0 101 0 0
...
user1 -- 1033 0 0 120 0 0

'o limits shown with this user as limits are set to 6.
<an page: repquota - summari=e quotas for a filesstem.
Cron:
*uota!he!k should s!an the file sstem 7ia !ron>o" periodi!all $sa# e7er week(%. 8dd a s!ript to the
-et!-!ron.weekl- dire!tor.
4ile: -et!-!ron.weekl-run*uota!he!k
Linux ?ernel ).,: &ed /at 0.1 - 4edora Core 5:
=>/b*n/bash
/sb*n/quotachec! -vguma
Linux ?ernel ).): &ed /at .-0.6:
=>/b*n/bash
/sb*n/quotachec! -v -a
$&emem"er to chmod ?x /etc/cron.wee!l+/run)uotachec!%
Edquota Note:
The "edquota" !ommand puts ou into a "7i" editing mode so knowledge of the "7i" editor is ne!essar. 8nother
editor ma "e spe!ified with the EDITOR en7ironment 7aria"le. @ou are NOT editing the quota.user file dire!tl.
The -partition-quota.user or quota.group file is a "inar file whi!h ou do not edit dire!tl. The !ommand edquota
gi7es ou an as!ii interfa!e with the text prepared for ou. Ahen ou ":wq" to sa7e the file from the 7i session# it is
!on7erted to "inar " the edquota !ommand and stored in the quota.user file.
8ssigning quota for a "un!h of users with the same 7alue. To rapidl set quotas for all users# on m sstem to the
same 7alue as user user1# ; would first edit user user1Bs quota information " hand# then exe!ute:
edquota -p user1 @aw! -8" AB3 C 300 Dpr*nt B1EA /etc/passwd@
This assumes that the user uidBs start from :66 and in!rement upwards. ""lo!ks in use" is the total num"er of
"lo!ks $in kilo"tes% a user has !omsumed on a partition. "inodes in use" is the total num"er of files a user has on a
partition.
edquota options:
Option Description
-r
-m
Edit quotas on remote ser7er using &PC. &emote ser7er must "e !onfigured with the daemon
rpc.rquotad
-u Edit user quota
-g Edit group quota
-p user-id Cupli!ate the quotas "ased on existing prototpe user
-4 format
-4 7fsold
-4 7fs76
-4 rp!
-4 xfs
4ormat:
7fsold - 7ersion 1
7fs76 - 7ersion )
rp! - quotas o7er '49
xfs - quotas for D49 filesstem
-f /file-system Perform on spe!ified filesstem. Cefault is to appl on all filesstems with quotas
-t Edit the soft time limits for ea!h filesstem.
-T Edit time for user-group when softlimit is enfor!ed. 9pe!if num"er and unit or "unset"
Soft Limit and Hard Limits:
9oft limit indi!ates the maximum amount of disk usage a quota user has on a partition. Ahen !om"ined with
"gra!e period"# it a!ts as the "order line# whi!h a quota user is issued warnings a"out his impending quota 7iolation
when passed. /ard limit works onl when "gra!e period" is set. ;t spe!ifies the a"solute limit on the disk usage#
whi!h a quota user !anBt go "eond his "hard limit".
Grace Period:
"Era!e Period" is !onfigured with the !ommand "edquota -t"# "gra!e period" is a time limit "efore the "soft
limit" is enfor!ed for a file sstem with quota ena"led. Time units of se!$onds%# min$utes%# hour$s%# da$s%# week$s%#
and month$s% !an "e used. This is what ouBll see with the !ommand "edquota -t":
9stem response:
Linux ?ernel ).,1: &ed /at 0.11-4edora:
(race per*od before enforc*ng soft l*m*ts for users"
F*me un*ts ma+ be" da+s, hours, m*nutes, or seconds
8*les+stem ;loc! grace per*od 'node grace per*od
/dev/hda 2da+s 2da+s
Linux ?ernel ).): &ed /at .-0.6:
F*me un*ts ma+ be" da+s, hours, m*nutes, or seconds
(race per*od before enforc*ng soft l*m*ts for users"
/dev/hda2" bloc! grace per*od" 0 da+s, f*le grace per*od" 0 da+s
Change the 6 das part to an length of time ou feel reasona"le. 8 good !hoi!e might "e 0 das $or 1 week%.
Quota fies: $non-D49 file sstems%
The edquota !ommand will !reate-edit the quota file at the root of the file sstem. $9ee /etc/mtab for the list of
the !urrentl mounted filesstems.%
+ersion ): aquota.user, aquota.group
+ersion 1: quota.user, quota.group

S-ar putea să vă placă și