Linux Quota mini-HOWTO

: Albert M.C. Tam (bertie@scn.org)
      1996.07.27() 21:04:38 PDT

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

----------------------------------------------------------------------------

Linux  quota ͭˤˡ

ǽ: 1996.07.27() 21:04:38 PDT

ʸ: ʸФ Albert M.C. Tam (bertie@scn.org) ͭƤ
 ( 1)Ū˸¤ꡢʸλѡԡۤĤ
롣ԤޤԼԤλ̾ӤιΤ򡢤٤ƤΥԡӴϢ
ʸʤФʤʤޤʸѤƤϤʤʤʸ
ۤ졢ͭѤ뤳ȤԤ롣Ƥ뤳ȤǤ
졢ż뤳ȤǤ졢ְڤݾڤԤʤסʲʸϲ줿
ΤǤ뤳Ȥݾڤ뤿ˤϤʧƤְ㤤
䡢ʸϤ˽񤫤줿ˤääﳲФԡԼԤ⤷ϴ
ϡǤʤס

(ʸ)
Preamble: This document is copylefted by Albert M.C. Tam (bertie@scn.org).
Permission to use, copy, distribute this document for non-commerical
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 ۥȾΥե롦ƥ quota 򤤤ƳΤ
ˤĤƵҤ롣桼¤ƤˡǤʤquota ޥɷ
͡ʻˡˤĤƤ⵭Ҥ롣桼ϡͥ 2.x ѤƤ
Ȥ (ƥȤ 2.0.7 ǹԤä)ŤͥѤƤ桼
ˤϥåץ졼ɤ򤹤롣

ʤ򸫤Ĥꡢ­ʤäȤˤϡեɥХå䥳
Ȥ bertie@scn.org ޤǵڤäƤۤ

----------------------------------------------------------------------------

quota Ȥ?

quota Ѥ뤳Ȥǡǥ֤ 2 Ĥ --- 桼ݻǤ
 inode οȥǥ֥åο --- ¤ꤹ뤳ȤǤ롣

桼ǥڡ̵¤˻Ѥ뤳Ȥػߤ (ۤȤɤλ) 
ƼΥǥ̤°ʲˤ褦˶롣줬quota ظˤ
ͤǤ롣

Linux Ǥ quota θ

quota ΥݡȤϥͥ 1.3.8x ˤ礵줿ʹƤ롣꡼
 2.0 ΥͥˤƤ⥵ݡȤƤ롣⤷⡢ʤΥƥब quota
 򥵥ݡȤƤʤΤʤСåץ졼ɤ򤹤롣

ߡquota  ext2 ե롦ƥˤƤΤư롣

Linux  quota Ѥ뤿ɬפʤ

ͥ

2.x Υͥ롦

     ftp://tsx-11.mit.edu/pub/linux/sources/system/v2.0/

Ǥ롣

quota եȥ

ƥ quota եȥ뤫ݤϡʤλäƤ Linux 
distribution Ǥ롣quota եȥΥ

     ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/subsystems/quota/all.tar.gz
     ( 2)
Ǥ롣

----------------------------------------------------------------------------

Linux Ǥ quota Υåȥå - Part I: 

1. ͥƹ

ͥκƹۤԤ

     Quota support (CONFIG_QUOTA) [n] y

 y ȥפquota ΥݡȤä롣

2. quota եȥΥѥȥ󥹥ȡ

quota եȥΥ

     ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/subsystems/quota/all.tar.gz
     ( 2)
Ǥ롣

˻䤬 quota եȥѥåϴ Linux ˰ܿƤꡢ
2.x ͥ뤬äƤ뤹٤Ƥ Linux ƥǥѥǤ롣ѥ
ˡC ѥ餬 MNTOPT ̤Ǥȥ顼Ф⤷ʤ
ξˤϡquota ѥå mntent.h  /usr/include/mntent.h ˥ԡ
ɬפ롣( 3)

3. ƥ൯ư quota åquota  on ˤ뤿 init 
ץȤ롣

ʲ򼨤:

        # 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

ȤƤϡ֤ʤ /etc/fstab Υե롦ƥबޥȤ
Ƥޤäָˡquota  on ˤ뤳ȤǤ롣ʤȡquota ư
ƥ init ץȤκǸ quota  on ˤΤ褤ߤˤ
Ƥϡƥ init ץǡե롦ƥबޥȤ줿ľ
Ǥ褤

4. /etc/fstab ν

ޤ quota ͭˤƤʤѡƥ̾ʲΤ褦˸롣

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

ե롦ƥ quota ǽä뤿ˡ"defaults" ȤޤǤ
 4 ܤΥեɤ "usrquota" ä롣

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

5. quota Ͽ "quota.user" κ

 quota εϿե롢quota.user νͭԤ root ˤ롣 root ˤϡ
߽񤭵ĤͿ¾ΤʤĤͿʤ褦ˤƤʤФʤʤ

root Ȥ login 롣quota ͭˤѡƥΥޥȤκܤ
ԤʲΤ褦ˤ quota.user 롣

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

6. Ƶư

ƥƵưޤޤǤ˹ԤäѹȿǤ롣

衢ۤΥѡƥ quota ͭˤȤˤϡstep 456 
ԤʤФ褤

Linux Ǥ quota Υåȥå - Part II: ƥ桼ؤ quota γ

 edquota ޥɤˤäƹԤ롣ȤСޥ "edquota bob"
 ¹Ԥȡvi (⤷ϡĶѿ $EDITOR ˤäƼ줿ǥ)ư
롣 quota ͭˤʤäƤ뤽줾ΥѡƥǤΥ桼 "bob" 
¤ꤹ롣

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

"blocks in use" ϥѡƥǥ桼񤷤Ƥ֥å(Хñ
)Ǥ롣

"inodes in use" ϥѡƥǥ桼񤷤ƤեǤ롣

eduota ˲äϤƤʤФʤʤѸ줬 3 Ĥ: Soft Limit Hard
 LimitGrace Period Ǥ롣

Soft Limit

̾ soft limit  quota 桼ѡƥǻѤǤǥ
κ̤򼨤Ƥ롣grace period ꤵƤȤˤϡκ
̤϶Ȥߤʤ롣ǥ̤ۤȥ桼 quota 
ۤƤݤηٹ롣

Hard Limit

hard limit  grace period ꤵƤȤˤΤߡ̣롣ǥ
ѤŪ¤򼨤Ƥꡢ桼Ϥ hard limit ۤ뤳ȤϤǤʤ

Grace Period

ޥ "edquota -t" ¹Ԥȡgreace period  soft limit ¤桼
˲ʤޤǻ֤Ȥʤ롣֤ñ̤ sec()min(ʬ)hour()day()
week()month()ѤǤ롣ʲϡޥ "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 days (ޤ 1 week)
 ˤƤ롣 

----------------------------------------------------------------------------

͡ quota ޥɷ

quotacheck

quotacheck ϥե롦ƥΥǥ̤Ĵ١quota εϿե 
"quota.user" ǿξ˹뤿˻Ȥ롣ƥ൯ư٤ 
quotacheck 餻뤫 cronjob ( 4) Ѥư (ȤС1 
 ?)  1 餻ɤ

repquota

repquota ϤҤȤĤΥե롦ƥˤĤơ quota νפ롣
 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

quotaon  quota ǽ on ˤ뤿˻Ȥ졢quotaoff  off ˤ뤿˻
롣ºݤˤ 2 ĤΥեƱΤǤ롣ϡƥबư
ȤȡƥबλȤ˼¹Ԥ롣
----------------------------------------------------------------------------

( 1)
 ʻΤ褦˸ʸϡ 
"Preamble: This document is copylefted by Albert M.C. Tam (bertie@scn.org)." 
Ǥ롣copyleft Ȥñ GNU ץȤ¤Ǥ롣Τʰ̣ط
ˤĤΤꤿͤϡ
	http://www.gnu.ai.mit.edu/copyleft/copyleft.html    
ɤȤ褤

ޤ GNU 饤󥹤ˤĤƤϡ
  http://pia.plaza.hitachi-sk.co.jp/%7Emasa-k/doc/think-gnu/
β˾󤬤롣

( 2)
1996.12.27 ߡǿǤ quota-1.55 Ǥꡢ
	ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/
			subsystems/quota/utils/quota-1.55.tar.gz
Ǥ롣

( 3)
quota-1.55  Makefile ˥Хꡢ# make install ¹Ԥȥ顼ˤʤ롣
 quotaon  quotaoff ˥󥯤ĥΥ顼Ǥ (ʸˤ褦
ϡƱΥեǤ) Τᡢưǥ󥯤ĥʤꡢMakefile
 ν򤹤ʤƼǹԤʤɬפ롣

( 4)
crontab Τȡ

----------------------------------------------------------------------------
ܸˤĤƤΤ䤤碌ϡ
	morioka@i.h.kyoto-u.ac.jp
äƤ	

ܸκˤ Linux-JF ץȤΰʲ¿ν򤤤
ޤ꤬Ȥޤ

ڤ	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
ë	jeanne@mbox.kyoto-inet.or.jp			
	nakano@apm.seikei.ac.jp/pfg03175@niftyserve.or.jp
Ȼ	yosshy@jedi.seg.kobe-u.ac.jp

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


