  Linux Quota mini-HOWTO

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

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

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

  Linux  quota Lɂ@

  ŏIXV: 1996.07.27(y) 21:04:38 PDT

  : ̕ɑ΂钘쌠 Albert M.C. Tam (bertie@scn.org) ۗLĂ
   (Ғ 1)BcړIɌA̎̕gpARs[єzz
  BA҂܂͕Ҏ҂̎т̍mAׂẴRs[ъ֘A
  ɖLȂ΂ȂȂB܂A̕ςĂ͂ȂȂB̕
  LzzALɗp邱Ƃ҂BAĂ邱Ƃł
  AÎ邱ƂłAu؂̕ۏ؂sȂvBȉ͉̕ꂽ
  񂪐mł邱Ƃۏ؂邽߂ɂw͂ĂBAԈႢ
  A͂̕ɏꂽɂĔQɑ΂AҁAҎ҂͊Ǘ
  ́uӔC𕉂ȂvB

  ()
  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.

  ̕ł́ALinux zXg̃t@CEVXe quota ɓ̂
  ɂċLqB[Uɐ蓖Ă@łȂAquota R}hQ
  ̗lXȎgp@ɂĂLqB[ÚAJ[l 2.x gpĂ
  Ƃ (eXg 2.0.7 ōs)BÂJ[lgpĂ郆[U
  ɂ̓AbvO[h߂B

  ȂA񂪑ȂƂɂ́AtB[hobNR
  g bertie@scn.org ܂ŋCyɑĂقB

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

  quota Ƃ?

  quota p邱ƂŁAfBXNu 2 ̖ --- 郆[Uێł
   inode ̐ƃfBXNEubN̐ --- ̐ݒ肷邱ƂłB

  [UfBXNEXy[X𖳐Ɏgp邱Ƃ֎~A (قƂǂ̎)
  ẽfBXNgpʂ̐ȉɂ悤ɋBꂪAquota ̔wɂ
  lłB

  Linux ł quota ̌

  quota ̃T|[g̓J[l 1.3.8x ɂēꂽƕĂB[X
   2.0 ̃J[lɂĂT|[gĂBAȂ̃VXe quota
   T|[gĂȂ̂Ȃ΁AAbvO[h߂B

  ݁Aquota  ext2 t@CEVXeɂĂ̂ݓ삷B

  Linux  quota gp邽߂ɕKvȂ

  J[l

  2.x ̃J[lE\[X

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

  łB

  quota \tgEFA

  VXe quota \tgEFA邩ۂ́AȂ̎Ă Linux
  distribution łBquota \tgEFÃ\[X

       ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/subsystems/quota/all.tar.gz
       (Ғ 2)
  łB

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

  Linux ł quota ̃ZbgAbv - Part I: ݒ

  1. J[lč\z

  J[l̍č\zsB

       Quota support (CONFIG_QUOTA) [n] y

   y ƃ^CvAquota ̃T|[gB

  2. quota \tgEFÃRpCƃCXg[

  quota \tgEFÃ\[X

       ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/subsystems/quota/all.tar.gz
       (Ғ 2)
  łB

  Ɏ quota \tgEFAEpbP[W͊ Linux ɈڐAĂA
  2.x J[lĂ邷ׂĂ Linux VXeŃRpCłBRpC
  ɁAC RpC萔 MNTOPT `łƃG[oȂB
  ̏ꍇɂ́Aquota pbP[W mntent.h  /usr/include/mntent.h ɃRs[
  KvB(Ғ 3)

  3. VXeN quota `FbNAquota  on ɂ邽߂ init XN
  vgCB

  ȉɗ:

          # 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

  PƂẮuȂ鎞v /etc/fstab ̃t@CEVXe}Eg
  Ă܂uɁvquota  on ɂ邱ƂłBȂƁAquota ͓삵
  BVXe init XNvg̍Ō quota  on ɂ̂悢BD݂ɂ
  ẮAVXe init XNvgŁAt@CEVXe}Egꂽ
  ł悢B

  4. /etc/fstab ̏C

  ܂ quota LɂĂȂp[eBV͒ʏȉ̂悤ɌB

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

  t@CEVXe quota @\邽߂ɁA"defaults" Ƃ܂ł
   4 Ԗڂ̃tB[h "usrquota" B

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

  5. quota L^ "quota.user" ̍쐬

   quota ̋L^t@CAquota.user ̏L҂ root ɂB root ɂ́A
  ݏ^ÂȂ鋖^Ȃ悤ɂĂȂ΂ȂȂB

  root Ƃ login Bquota Lɂp[eBṼ}Eg̍{
  sAȉ̂悤ɂ quota.user 쐬B

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

  6. ċN

  VXeċNA܂܂łɍsύX𔽉fB

  Aق̃p[eBV quota LɂƂɂ́Astep 4A5A6 
  sȂ΂悢B

  Linux ł quota ̃ZbgAbv - Part II: e[Uւ quota ̊蓖

  ̑ edquota R}hɂčsBƂ΁AR}h "edquota bob"
   sƁAvi (́Aϐ $EDITOR ɂĎꂽGfB^)N
  B quota LɂȂĂ邻ꂼ̃p[eBVł̃[U "bob" 
  ݒ肷B

          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" ̓p[eBVŃ[UĂubN(LoCgP
  )̑łB

  "inodes in use" ̓p[eBVŃ[UĂt@C̑łB

  eduota ɉAKnĂȂ΂ȂȂpꂪ 3 : Soft LimitA Hard
   LimitAGrace Period łB

  Soft Limit

  ʏA soft limit  quota 郆[UAp[eBVŎgpłfBX
  N̍őʂĂBAgrace period ݒ肳ĂƂɂ́A̍
  ʂ͋EƂ݂ȂBfBXNgpʂ̐zƃ[U quota 
  zĂ|̌x󂯂B

  Hard Limit

  hard limit  grace period ݒ肳ĂƂɂ̂݁AӖBfBXNg
  p̐ΓIȐĂA[U͂ hard limit z邱Ƃ͂łȂB

  Grace Period

  R}h "edquota -t" sƁAgreace period  soft limit ̐[
  UɉȂ܂ŎԂƂȂBԂ̒Pʂ sec(b)Amin()Ahour()Aday()A
  week(T)Amonth()gpłBȉ́AR}h "edquota -t" sƂ
  ̗ł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

  0 days ̕荠ȎԂ̒ɕύXB̏ꍇ́A7 days (܂ 1 week)
   ɂĂB

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

  lX quota R}hQ

  quotacheck

  quotacheck ̓t@CEVXẽfBXNgpʂ𒲂ׁAquota ̋L^t@C
  "quota.user" ŐV̏󋵂ɍXV邽߂ɎgBVXeN̓x
  quotacheck 𑖂点邩A cronjob (Ғ 4) pĈ (Ƃ΁A1 T
   ?)  1 x点Ɨǂ낤B

  repquota

  repquota ͂ЂƂ̃t@CEVXeɂāA quota ̏Wv쐬B
   repquota ̏o͗ł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

  quotaon  quotaoff

  quotaon  quota @\ on ɂ邽߂ɎgAquotaoff  off ɂ邽߂Ɏg
  Bۂɂ 2 ̃t@Ĉ͓łB́AVXeN
  ƂƁAVXeIƂɎsB
  ----------------------------------------------------------------------------

  (Ғ 1)
   L̂悤Ɍ́A
  "Preamble: This document is copylefted by Albert M.C. Tam (bertie@scn.org)."
  łBcopyleft ƂP GNU vWFNg̑łBmȈӖAwi
  ɂĒm肽ĺA
          http://www.gnu.ai.mit.edu/copyleft/copyleft.html
  ǂނƂ悢낤B

  ܂ GNU CZXɂẮA
    http://pia.plaza.hitachi-sk.co.jp/%7Emasa-k/doc/think-gnu/
  ̉ɏ񂪂B

  (Ғ 2)
  1996.12.27 ݁AŐVł quota-1.55 łA
          ftp://ftp.funet.fi/pub/Linux/PEOPLE/Linus/
                          subsystems/quota/utils/quota-1.55.tar.gz
  łB

  (Ғ 3)
  quota-1.55  Makefile ɃoOA# make install sƃG[ɂȂB
   quotaon  quotaoff ɃN𒣂鏊̃G[ł ({ɂ悤A
  ́Ãt@Cł) B̂߁A蓮ŃN𒣂ȂAMakefile
   ̏CȂeōsȂKvB

  (Ғ 4)
  crontab ̂ƁB

  ----------------------------------------------------------------------------
  {ɂĂ̂₢킹́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

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

