Quota mini-HOWTO

Albert M.C. Tam

bertie@scn.org

JF Project - {

v0.0, 8 August 1997

܂F́̕AAlbert M.C. Tam (bertie@scn.org) uRs[tg
vĂ܂B񏤗pړIɌApEEЕz܂A̍
́A҂ѕҏW҂̎Ƃ̗pׂĂ̕ѕt
ɕ\邱ƁAɉςȂƂƂȂ܂B̕
́Aǎ҂̖ɗƂĔzzĂ܂AIEَIȔ@
Ȃۏ؂܂BmȏLڂ悤o̓w͂Ă
܂AҁEҏWҁEǗ҂́Ǎ̕T╶̏ɂ
ĐQɂāA@ȂӔC܂B

́̕ALinux zXgŃt@CVXe̗eʐ(quota)Lɂ
@A[UO[vɗeʐ@AюX quota R}
h̎gɂĉ̂łBkernel 2.x gĂ郆[U
ۂƂĂ܂ (RedHat 4.1  kernel 2.0.27 𑖂点Ă}Vō
ṼeXgs܂)BÂ kernel gĂ郆[ÚA
kernel ̃o[WグȂ΁Aquota ̐V@\gȂ
܂BԈႢ̌΁AȂ bertie@scn.org ܂ŃtB[
hobNRg𑗂ĂB낵肢܂B



Table of Contents
1. quota Ƃ́H
2. Linux ɂ quota ̌
3. Linux  quota g߂̓
   
    3.1. Kernel
    3.2. quota \tgEFA
   
4. quota ̐ݒ - p[g1F{ݒ
   
    4.1. J[l̍č\z
    4.2. quota \tgEFÃRpCƃCXg[
    4.3. VXe init XNvgҏWAN quota `FbN
        Aquota Iɂ
    4.4. /etc/fstab ̕ҏW
    4.5. quota L^t@C "quota.user"  "quota.group" 쐬
    4.6. u[g
   
5. quota ̐ݒ - p[g2F[UƃO[v quota 蓖Ă
   
    5.1. ̃[U quota 蓖Ă
    5.2. ̃O[v quota 蓖Ă
    5.3. lÃ[UɊ蓖Ă
    5.4. \tg~bg
    5.5. n[h~bg
    5.6. P\
   
6. X quota R}h
   
    6.1. quotacheck
    6.2. repquota
    6.3. quotaon  quotaoff
   
7. {ɂ

1. quota Ƃ́H

quota Ƃ́Aӂ̑ʂfBXNXg[W̗pɈ̐ۂ
̂łBȂ킿Aquota gƁAX̃[U⃆[UO[vɑ΂
āAł inode 肵Ap\ȃfBXNubN𐧌
Ƃł܂B

ƁA[UVXẽfBXNXy[XیȂgƂ
oȂ悤ɂāA[ŨfBXNʂxȉɕۂƂ
A quota ̔wɂlłBquota ̐ݒ́A[UƁAt@C
VXeƂɍs܂B䂦Ãt@CVXeɂ܂
[Ut@C쐬ł悤ɂȂĂꍇAX̃t@CVXe
ɑ΂Čʂ quota ݒ肷Kv܂B



2. Linux ɂ quota ̌

quota ̃T|[ǵAkernel v1.3.8x ̂Ƃ kernel ɑgݍ܂Ă
łBł́ALinux kernel ̃[X 2.0 ̈ꕔƂȂĂ܂B
ǎ҂̃VXe kernel  quota T|[gĂȂȂAkernel ̃A
bvO[h߂܂B

݁Aquota ́Aext2 t@CVXeł삵܂B



3. Linux  quota g߂̓

3.1. Kernel

2.x kernel \[X́ÃTCgœł܂B

http://sunsite.unc.edu/pub/Linux/kernel/v2.0/



3.2. quota \tgEFA

Linux fBXgr[VɂāAquota \tgEFA͓ǎ҂̃VXe
ɃCXg[ꂽAȂ肵܂BCXg[Ă
ꍇ́Ȁꏊ quota \tgEFA_E[hĂB

ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/subsystems/quota/all.tar.gz

(󒍁Fŋ߂̃fBXgr[Vg̏ꍇAquota ֌W̃\tgE
FA͊ɃCXg[ĂꍇƎv܂BȂɂԂÂ
 (1997N8) ̖|Ȃ̂ŁÂ͂e͂B͂̈͂
O͂ɂĂAsvȏꍇ邩܂B)



4. quota ̐ݒ - p[g1F{ݒ

4.1. J[l̍č\z

J[lč\z̍ۂ quota support  y ƃ^CvāAquota Lɂ
܂B

  Quota support (CONFIG_QUOTA) [n] y                                   



4.2. quota \tgEFÃRpCƃCXg[

quota \tgEFÁAȉœł܂B

ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/subsystems/quota/all.tar.gz



4.3. VXe init XNvgҏWAN quota `FbNA
quota Iɂ

ȉA̐ݒłB

  # Check quota and then turn quota on.                                
  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                                                           

 

ҏW̍ۂɂ́Advȃ[܂Bquota ́A/etc/fstab ɋLڂꂽ
t@CVXeׂă}EgĂANׂAƂƂł
BłȂƁAquota ͗LɂȂ܂BVXe init XNvg̍Ō
̕ quota N邩ÁAt@CVXe}Eg
ӏ̒ quota N邱Ƃ߂܂B



4.4. /etc/fstab ̕ҏW

p[eBV quota ̐ݒ܂LɂĂȂꍇA/etc/fstab
͎̂悤ɂȂĂƎv܂B

  /dev/hda1       /       ext2    defaults        1       1            
  /dev/hda2       /usr    ext2    defaults        1       1            

 

t@CVXeŃ[U quota Lɂɂ́A"defaults" ƂP
ꂪĂ 4 ߂̃tB[h "userquota" ƕt܂ (ڍ
́Afstab ̃}jAy[W)B

  /dev/hda1       /       ext2    defaults        1       1            
  /dev/hda2       /usr    ext2    defaults,usrquota       1       1    

 

O[v quota Lɂꍇɂ́A"userquota"  "grpquota" ɒu
ĂB

  /dev/hda1       /       ext2    defaults        1       1            
  /dev/hda2       /usr    ext2    defaults,grpquota       1       1    

 

[U quota ƃO[v quota ̗Lɂꍇ́Â悤ɂȂ
܂B

  /dev/hda1       /       ext2    defaults        1       1             
  /dev/hda2       /usr    ext2    defaults,usrquota,grpquota       1   1

 



4.5. quota L^t@C "quota.user"  "quota.group" 쐬

quota.user  quota.group Ƃ quota L^t@C (quota record file)
́AƂ root t@CL҂ƂAroot  read-write p[~b
Vݒ肵ŁAȊÕ[U͂ǂݏsłȂ
ɂ܂B

܂Aroot ŃOC܂BāAquota Lɂp[eBV
̃[gfBNgɈړAquota.user  quota.group ̂悤ɍ
܂B

  touch /partition/quota.user                                          
  touch /partition/quota.group                                         
  chmod 600 /partition/quota.user                                      
  chmod 600 /partition/quota.group                                     

 



4.6. u[g

ȏŃu[gāA܂ōsݒLɂ܂B

ȍ~Aquota Lɂp[eBVoĂꍇAKvȐݒ
͏L菇 4, 5, 6 ƂȂ܂B



5. quota ̐ݒ - p[g2F[UƃO[v quota 蓖Ă

quota ̊蓖Ăɂ́Aedquota R}hg܂ (ڍׂ́Aedquota R}
h̃}jAy[W)B

҂́AiAquota ̕ҏWOɁAquotacheck  -avug tOt
ĎsAt@CVXe̍ŐV̗p󋵂悤ɂĂ܂B
A͌lIȏKɂȂ̂ŁAK{ł͂܂B



5.1. ̃[U quota 蓖Ă

ȉɗ܂Bł́AVXe bob ƂOC id 
[UƂ܂B"edquota -u bob" ƂR}hs
vi (́Aϐ $EDITOR Ŏw肳ꂽGfB^) J܂B
Aquota ݒ肪\ȌX̃p[eBVꂼɂẮA[U bob
 quota Lq܂B

  Quotas for user bob:                                                 
  /dev/hda2: blocks in use: 2594, limits (soft = 5000, hard = 6500)    
             inodes in use: 356, limits (soft = 1000, hard = 1500)     

 

L "blocks in use" Ƃ̂́Ã[Ũp[eBVŊ
ɏĂubN̑Ă܂B

"inodes in use" Ƃ̂́Ã[Ũp[eBVɕێ
t@C̑Ă܂B



5.2. ̃O[v quota 蓖Ă

́AVXe games ƂO[vƂ܂B"edquota -u
games" ƂR}hsƁAēx vi GfB^ĴŁAɃO
[v games  quota Lq܂B

  Quotas for group games:                                              
  /dev/hda4: blocks in use: 5799, limits (soft = 8000, hard = 10000)   
             inodes in use: 1454, limits (soft = 3000, hard = 4000)    

 



5.3. lÃ[UɊ蓖Ă

Ⴆ΃VXe 100 l̃[Uɑ΂āA[U bob Ɠl quota
΂₭蓖Ă悤ƂꍇA҂ȂA܂ bob  quota 
蓮œ͂ĂÃR}hs܂B

  edquota -p bob `awk -F: '$3 > 499 {print $1}' /etc/passwd`           

 

LR}h́Acsh gĂ邱ƁAшÃ[Ũ[U ID 
500 Ԃn܂Ă邱ƂOɂȂĂ܂B

edquota R}hȊOɂAmĂȂ΂ȂȂpꂪ 3 ܂B
\tg~bg (Soft Limit)An[h~bg (Hard Limit)AP\
(Grace Period) łB



5.4. \tg~bg

\tg~bg (Soft Limit) Ƃ́Aquota ̃[Ũp[eBV
Ő߂邱ƂłőfBXNeʂ̂łBP\ (grace
period) Ƒgݍ킹邱ƂŁA\tg~bǵA[Uɑ΂{[_[
CƂċ@\܂BȂ킿Ã{[_[z_ŁA[U
΂āA quota ᔽƂȂĂ|̌x܂B



5.5. n[h~bg

n[h~bg (Hard Limit) ́AP\ (grace period) ̌oߒɂ̂
@\܂B́AfBXNgpʂ̐ΓIȐłAquota ̃[U
͂̃n[h~bgĉz邱Ƃ͂ł܂B



5.6. P\

P\ (grace period) Ƃ́AԂ̂ƂłAzƁA
quota Lɂt@CVXeŁA\tg~bgIɎs
܂B́AR}h "edquota -t" gĐݒ肷悤ɂȂĂ
AԊԊuƂẮAb(sec)A(min)A(hour)A(day)AT(week)A
(month) g܂BȉɁAR}h "edquota -t" gۂɕ\
ʂ܂B

  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     

 

L 0 days ̕KȊԊuɒuĂB҂́AlI
7 days ( 1 week) IԂ悤ɂĂ܂B



6. X quota R}h

6.1. quotacheck

quotacheck ́At@CVXẽfBXNp󋵂XLA
quota L^t@Cł quota.user ŐV̏ԂɍXVۂɎgp
BVXeN quotacheck 𑖂点邩Acron WuƂĒI
s (Ⴆ΁ATƂ) Ƃ߂܂B



6.2. repquota

repquota ́At@CVXeɊւ quota Wv\
łBȉ́Arepquota ̃Tvo͂łB

  # 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         

 



6.3. quotaon  quotaoff

quotaon ́Aquota @\Iɂ̂ŁAquotaoff ͂Itɂ
̂łBۂɂ́ÃR}ht@C͔ɎʂĂ܂B
́AVXe̋NƏIɎs܂B



7. {ɂ

{ɂĂ̂₢킹́A morioka@i.h.kyoto-u.ac.jp ɑĂ
B

{̍쐬ɂ Linux-JF vWFNg̈ȉ̕X瑽̏
܂B肪Ƃ܂B

r؂     yasu@mizuno.riec.tohoku.ac.jp                    
ɓ     nozomi@biol.tsukuba.ac.jp                        
삳     ono@jf.gee.kyoto-u.ac.jp                         
     isle@st.rim.or.jp/kojima@criepi.denken.or.jp     
т     daihei@hucom.co.jp                               
sugawara hiro@lynx.com                                    
dezawa   dezawa@miya.fujifilm.co.jp                       
J     jeanne@mbox.kyoto-inet.or.jp                     
삳     nakano@apm.seikei.ac.jp/pfg03175@niftyserve.or.jp
gR     yosshy@jedi.seg.kobe-u.ac.jp                     

F 牪Y                 morioka@i.h.kyoto-u.ac.jp/               
                              t-morioka@nri.co.jp                      
     1997.01.13() 18:14:43                                           
     JST                                                               

XVF UTi     ysendda@pop01.odn.ne.jp (2001/09/15)
ZF KcЂ coda@post.kek.jp                    

