<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> <article lang="ko"> <articleinfo> <title>Quota mini-HOWTO</title> <author lang="en"> <firstname>Ralf</firstname> <surname>van Dooren</surname> <affiliation> <address> <email>r.vdooren (at) snow.nl</email> </address> </affiliation> </author> <othercredit role="translator"> <surname>윤</surname> <firstname>현호</firstname> <affiliation> <address> <email>hhyoon (at) kldp.org</email> </address> </affiliation> </othercredit> <pubdate>v0.2, January 2002</pubdate> <revhistory> <revision> <revnumber>0.2</revnumber> <date>2002-01-23</date> <authorinitials>hhyoon</authorinitials> <revremark>번역 갱신</revremark> </revision> <revision> <revnumber>0.1</revnumber> <date>1999-09-30</date> <authorinitials>이정균</authorinitials> <revremark>최초 번역</revremark> </revision> </revhistory> <abstract> <para> <!-- Preamble: This document is copyleft 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. --> 이 문서는 Ralf van Dooren <email>r.vdooren (at) snow.nl</email>에 의해 작성되었으며, 이 문서의 기본 텍스트와 설정은 Albert M.C. Tam에 의해 쓰여졌다. 이 mini-HOWTO의 초기 문서를 작성해준 그에게 깊은 감사를 느낀다. 초기 문서의 번역은 이정균님께서 하셨다. 이 문서는 GNU Free Documentation License를 따른다. </para> </abstract> </articleinfo> <para> <!-- 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. --> 이 문서는 비상업적인 목적으로 모든 복사본과 지원 문서에 저자와 편집자의 이름, 그리고 이 주의 사항을 포함된, 즉 문서가 수정되지 않은 상태로 사용, 복사, 배포할 수 있다. 이 문서가 유용한 글이 되기를 바라면서 배포되었으나, 표현되거나 함축된 말에 대해서 어떠한 보증은 할 수 없다. 이 문서내에 포함된 정보의 정확성을 보증하는데 모든 노력에도 불구하고, 이 문서내에 포함된 내용으로 인해 발생한 어떠한 오류나 손실에 대해 저자와 편집자 그리고 유지보수하는 사람은 어떠한 책임도 가지지 않는다. </para> <para> <!-- This document describes how to enable file system quota on a Linux host, assigning quota for users and groups, as well as the usage of miscellaneous quota commands. It is intended for users running kernel 2.x (recently tested on Red Hat 7.2 running kernel 2.4.xx) Users running older kernels may need to upgrade to a newer kernel version in order to take advantage of quota. Feel free to send feedbacks or comments to r.vdooren@snow.nl if you find an error, or if any information is missing. I appreciate it. --> 이 문서는 리눅스 호스트의 화일시스템에서 quota를 사용하는 방법 - 사용자와 그룹에게 디스크 사용량을 부여하고, quota의 여러 명령어의 사용 방법 등 - 에 대해서 기술한다. 이 문서는 커널 2.x를 사용하는 사용자를 위한 것이다. 커널 2.4.xx의 Red Hat 7.2에서 테스트되었다. 이전 버전의 커널을 사용하는 사용자는 quota를 제대로 활용하기 위해서 업그레이드를 해야할 것이다. 에러를 발견하거나 어떤 정보가 빠져있으면 <email>r.vdooren (at) snow.nl</email>로 서슴치 말고 의견을 보내주기 바란다. 나는 감사히 여길 것이다. 한글 번역에 대한 오류가 있을 시에는 <email>hhyoon (at) iname.com</email>으로 의견을 보내주면 수정하겠다. </para> <sect1> <title><!--What is Quota?-->Quota란 무엇인가?</title> <para> <!-- Quota allows you to specify limits on two aspects of disk storage: the number of inodes a user or a group of users may possess; and the number of disk blocks that may be allocated to a user or a group of users. --> Quota는 사용자나 혹은 그룹이 가질 수 있는 inode의 수, 혹은 사용자나 그룹에게 할당된 디스크 블럭의 수를 제한함으로써, 디스크 저장 장치의 사용을 제한할 수 있게 해준다. 즉, Quota는 사용자나 그룹의 디스크 사용량을 제한할 수 있는 방법을 제공해준다. </para> <para> <!-- The idea behind quota is that users are forced to stay under their disk consumption limit, taking away their ability to consume unlimited disk space on a system. Quota is handled on a per user, per file system basis. If there is more than one file system which a user is expected to create files, then quota must be set for each file system separately. --> Quota의 기본 개념은 사용자가 그들에게 부여된 디스크의 제한 용량 이상으로 사용하지 못하게 하며, 시스템의 디스크 공간을 무제한적으로 사용하지 못하게 한다. Quota는 사용자 별, 파일 시스템 별로 동작된다. 한 사용자에 파일을 만들 수 있는 파일 시스템이 하나 이상이라면, 각각의 파일 시스템에 개별적으로 Quota를 설정해줘야 한다. </para> </sect1> <sect1> <title><!--Current Status of Quota on Linux-->리눅스에서 Quota 지원</title> <para> <!-- Quota support has been integrated into kernel since version 1.3.8x I heard. Now it is part of the 2.0 release of the Linux kernel. If your system doesn't support quota, I really recommend an upgrade. --> Quota 지원은 버젼 1.3.8x에서부터 커널에 포함되었다. 지금은 리눅스 커널 2.0 릴리즈의 한 부분이다. 여러분의 시스템이 Quota를 지원하지 않는다면, 업그레이드하기 바란다. </para> <para> <!-- Currently, quota works for ext2 type file system only. --> 현재 Quota는 ext2 화일 시스템에서만 동작한다. </para> </sect1> <sect1> <title><!--Requirements for Using Quota on Linux--> 리눅스에서 Quota를 사용하기 위한 요구 사항</title> <sect2> <title>Kernel</title> <para> <!-- The 2.x kernel source is available from <programlisting> http://www.kernel.org </programlisting> . Please use an available mirror close to your location to save bandwidth. --> 커널 2.x 소스는 <ulink url="http://www.kernel.org">http://www.kernel.org</ulink>에서 구할 수 있다. 서버의 자원을 아끼기 위해 가능하면 여러분의 위치에서 가까운 곳의 미러 사이트를 이용하기 바란다. 한국의 미러 사이트는 <ulink url="http://www.kr.kernel.org">http://www.kr.kernel.org</ulink>이다. </para> </sect2> <sect2> <title><!--Quota software-->Quota 소프트웨어</title> <para> <!-- Depending on the Linux distribution you have, you may, or may not have the quota softwares installed on your system. If you don't, then download the quota software source from <programlisting> ftp://ftp.funet.fi/pub/Linux/tools/quota-1.31.tar.gz </programlisting> . --> 여러분의 가지고 있는 리눅스 배포본에 따라, 시스템에 Quota 소프트웨어가 설치되어 있거나, 혹은 설치되어 있지 않을 수도 있다. 설치되어 있지 않다면, Quota 소프트웨어의 소스를 <ulink url="ftp://ftp.funet.fi/pub/Linux/tools/quota-1.31.tar.gz">여기</ulink>에서 다운로드할 수 있다. </para> </sect2> </sect1> <sect1> <title><!--Quota Setup on Linux - Part I: The Configuration--> 리눅스에서 Quota 설정 - 1 장: 환경 설정</title> <sect2> <title><!--Reconfigure your kernel-->커널 재설정</title> <para> <!-- Reconfigure your kernel and add quota support by typing y to: <programlisting> Quota support (CONFIG_QUOTA) [n] y </programlisting> --> Quota를 지원할 수 있도록 다음과 같이 커널을 재설정한다. <programlisting> Quota support (CONFIG_QUOTA) [n] y </programlisting> </para> </sect2> <sect2> <title><!--Compile and install the quota softwares--> Quota 소프트웨어 컴파일 및 설치</title> <para> <!-- Most Linux distributions can help you installing the quota package. If not, or if you don't want to use this, you can download the latest version of the quota software source from <programlisting> ftp://ftp.funet.fi/pub/Linux/tools/quota-1.31.tar.gz </programlisting> --> 대부분의 리눅스 배포본에서는 Quota 소프트웨어가 설치되어 있거나, 쉽게 설치할 수 있다. 그렇지 않다거나, 어떻게 설치해야 하는지 모른다면, <ulink url="ftp://ftp.funet.fi/pub/Linux/tools/quota-1.31.tar.gz">여기</ulink>에서 최신 버젼의 Quota 소프트웨어를 다운로드할 수 있다. </para> <para> <!-- Compile and install the quota software. --> Quota 소프트웨어를 컴파일하고 설치하라. </para> </sect2> <sect2> <title><!--Modify your system init script to check quota and turn quota on at boot time--> Quota를 검사하고 부트 시에 Quota를 작동시키기 위해 시스템 init 스크립트 수정 </title> <para> <!--Here's an example:--> 다음 예를 살펴보자. <programlisting> # 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 </programlisting> </para> <para> <!-- The golden rule is that always turn quota on after your file systems in /etc/fstab have been mounted, otherwise quota will fail to work. I recommend turning quota on right after the part where file systems are mounted in your system init script. --> 가장 좋은 방법은 <filename>/etc/fstab</filename>에 명시된 파일 시스템이 마운트된 후 항상 Quota를 켜놓는 것이다. 시스템 init 스크립트의 끝부분 또는 파일 시스템이 마운트되는 부분의 바로 뒷부분에 Quota를 켜놓는 것을 추천한다. </para> </sect2> <sect2> <title><!--Modify /etc/fstab--><filename>/etc/fstab</filename> 수정</title> <para> <!-- Partitions that you have not yet enabled quota normally look something like: --> 일반적으로 Quota가 작동되기 전의 파티션 정보는 다음과 같다. <programlisting> /dev/hda1 / ext2 defaults 1 1 /dev/hda2 /usr ext2 defaults 1 1 </programlisting> </para> <para> <!-- To enable user quota support on a file system, add "usrquota" to the fourth field containing the word "defaults" (man fstab for details). --> 파일 시스템에 사용자 Quota 지원을 가능하게 하려면, "defaults" 단어 뒤, 즉 네번째 항에 "usrquota"를 추가한다. 더 자세한 정보는 <filename>fstab</filename> 매뉴얼 페이지(<filename>`man fstab`</filename>)를 참고하라. <programlisting> /dev/hda1 / ext2 defaults 1 1 /dev/hda2 /usr ext2 defaults,usrquota 1 1 </programlisting> </para> <para> <!-- Replace "usrquota" with "grpquota", should you need group quota support on a file system. --> 파일 시스템에 그룹 Quota 기능이 필요하면, "usrquota" 대신 "grpquota"를 추가하라. <programlisting> /dev/hda1 / ext2 defaults 1 1 /dev/hda2 /usr ext2 defaults,grpquota 1 1 </programlisting> </para> <para> <!-- Need both user quota and group quota support on a file system? --> 파일 시스템에 사용자 Quota와 그룹 Quota 둘다 필요하다면 다음과 같이 하면 될 것이다. <programlisting> /dev/hda1 / ext2 defaults 1 1 /dev/hda2 /usr ext2 defaults,usrquota,grpquota 1 1 </programlisting> </para> </sect2> <sect2> <title><!--Create quota record "quota.user" and "quota.group"--> Quota 기록 파일 "quota.user"와 "quota.group" 생성</title> <para> <!-- Both quota record files, quota.user and quota.group, should be owned by root, and read-write permission for root and none for anybody else. --> <filename>quota.user</filename>와 <filename>quota.group</filename>, 이 두 Quota 기록 파일은 root 소유이어야 하고, root 이외에는 어느 누구도 읽기/쓰기 권한을 줘서는 안된다. </para> <para> <!-- Login as root. Go to the root of the partition you wish to enable quota, then create quota.user and quota.group by doing: --> root로 로그인한 후, Quota를 활성화시킬 파티션의 루트 디렉토리로 이동하라. 그런 후 <filename>quota.user</filename>와 <filename>quota.group</filename> 파일을 다음과 같이 만든다. <programlisting> touch /partition/quota.{user,group} chmod 600 /partition/quota.{user,group} </programlisting> </para> </sect2> <sect2> <title><!--Activate the quota system--> Quota 시스템 활성화시키기 </title> <para> <!-- To activate the quota software you can reboot the system for the changes you have made to take effect. --> Quota 소프트웨어를 활성화시키기 위해, 여러분이 수정한 것이 영향을 미칠 수 있도록 시스템을 리부트한다. </para> <para> <!-- A better alternative is to execute the system init script you just created. This will initialize the quota database. If you do a `ls -la /partition/quota.*` you will notice that the file sizes are no longer of size zero. This will tell you that quota is working. --> 더 좋은 방법은 여러분이 만든 시스템 init 스크립트를 실행시키는 것이다. 이것은 Quota 데이타베이스를 초기화시킬 것이다. 만약 <filename>`ls -la /partition/quota.*`</filename> 명령을 실행해보면 파일 크기가 더 이상 0 이 아니라는 것을 알게 될 것이다. 이것은 Quota가 동작하고 있다는 것을 말한다. </para> <para> <!-- Also note that subsequent partitions you wish to enable quota in the future only require step 4, 5, and 6. --> 나중에 다른 파티션에도 Quota를 가능하게 하려면 4, 5, 6번 과정을 되풀이하면 된다. </para> </sect2> <sect2> <title><!--Add quotacheck to crontab--> crontab에 quotacheck 추가 </title> <para> <!-- Quotacheck should be running periodically, e.g. weekly. Add the following line to your root's crontab: --> Quotacheck는 주기적으로, 즉 일주일마다 실행되면 될 것이다. 다음 줄을 root의 crontab에 추가하라. (<filename>`crontab -e`</filename>) <programlisting> 0 3 * * 0 /sbin/quotacheck -avug </programlisting> </para> </sect2> </sect1> <sect1> <title><!--Quota Setup on Linux - Part II: Assigning Quota for Users and Groups--> 리눅스에서 Quota 설정 - 2 장: 사용자와 그룹에게 할당량 배정</title> <para> <!-- This operation is performed with the edquota command (`man edquota` for details). --> 이것은 <filename>edquota</filename> 명령을 통해 행해진다. (자세한 것은 <filename>`man edquota`</filename>를 참고하기 바란다.) </para> <sect2> <title><!--Assigning quota for a particular user--> 특정 사용자에게 디스크 할당량 배정 </title> <para> <!-- Here's an example. I have a user with the login id bob on my system. The command "edquota -u bob" takes me into vi (or editor specified in my $EDITOR environment variable) to edit quota for user bob on each partition that has quota enabled: --> 여기 한가지 예가 있다. 만약 시스템에 로그인 아이디 bob이라는 사용자가 있고, 이 사용자의 디스크 할당량을 배정하기 위해 "edquota -u bob" 명령을 사용함으로써 vi 에디터(또는 $EDITOR 환경변수에 설정한 에디터)로 quota가 설치된 각 파티션의 bob이라는 사용자의 할당량을 수정할 수 있다. <programlisting> Quotas for user bob: /dev/hda2: blocks in use: 2594, limits (soft = 5000, hard = 6500) inodes in use: 356, limits (soft = 1000, hard = 1500) </programlisting> </para> <para> <!-- "blocks in use" is the total number of blocks (in kilobytes) a user has consumed on a partition. --> "blocks in use"는 한 파티션에서 사용자가 사용 중인 총 블럭(kilobyte 단위)을 의미한다. </para> <para> <!-- "inodes in use" is the total number of files a user has on a partition. --> "inodes in use"는 한 파티션에서 사용자가 사용 중인 파일의 총합이다. </para> </sect2> <sect2> <title><!--Assigning quota for a particular group--> 특정 그룹에 디스크 할당량 배정</title> <para> <!-- Now I have a group games on my system. "edquota -g games" takes me into the vi editor again to edit quota for the group games: --> 시스템에 games이라는 그룹이 있고, 이 그룹의 디스크 사용량을 제한하고 싶다면, "edquota -g games" 명령을 사용하면 된다. 그러면 vi 에디터를 이용해 games 그룹의 할당량을 수정할 수 있다. <programlisting> Quotas for group games: /dev/hda4: blocks in use: 5799, limits (soft = 8000, hard = 10000) inodes in use: 1454, limits (soft = 3000, hard = 4000) </programlisting> </para> </sect2> <sect2> <title><!--Assigning quota for a bunch of users with the same value--> 일련의 사용자들에게 같은 값으로 디스크 할당량 배정 </title> <para> <!-- To rapidly set quotas for, say 100 users, on my system to the same value as my user bob, I would first edit bob's quota information by hand, then execute: --> 예를 들어 100명의 사용자의 할당량을 사용자 bob과 같은 값으로 빨리 설정하기 위해서는, 먼저 bob의 할당량 정보를 직접 수정한 후에 다음 명령을 수행하면 된다. <programlisting> edquota -p bob `awk -F: '$3 > 499 {print $1}' /etc/passwd` </programlisting> </para> <para> <!-- assuming that you are using csh, and that you assign your user UID's starting with 500. --> 여기에서 csh을 사용하고 있다고 가정하며, 사용자의 UID가 500부터 시작한다고 가정하고 있다. </para> <para> <!-- In addition to edquota, there are 3 terms which you should familiarize yourself with: Soft Limit, Hard Limit, and Grace Period. --> 추가적으로 edquota에서는 Soft Limit, Hard Limit, 유예 기간(Grace Period)이라는 단어의 의미를 알아야 한다. </para> </sect2> <sect2> <title>Soft Limit</title> <para> <!-- _Soft limit_ indicates the maximum amount of disk usage a quota user has on a partition. When combined with grace period, it acts as the border line, which a quota user is issued warnings about his impending quota violation when passed. --> Soft limit는 한 파티션에서 사용자가 쓸 수 있는 최대 용량을 가리킨다. 그러나 유예 기간(grace period) 내에 있어서는 사용자는 사용 용량 초과에 대해서 경고를 받게 되는 경계선처럼 동작한다. </para> </sect2> <sect2> <title>Hard Limit</title> <para> <!-- Hard limit works only when grace period is set. It specifies the absolute limit on the disk usage, which a quota user can't go beyond his hard limit. --> Hard limit는 유예 기간(grace period)이 설정되어 있을 때에만 동작한다. 이것은 디스크 사용에 있어서 절대적인 제한을 의미한다. 즉, 사용자는 hard limit 이상의 디스크 공간을 사용할 수 없다. </para> </sect2> <sect2> <title>Grace Period</title> <para> <!-- Executed with the command "edquota -t", grace period is a time limit before the soft limit is enforced for a file system with quota enabled. Time units of sec(onds), min(utes), hour(s), day(s), week(s), and month(s) can be used. This is what you'll see with the command "edquota -t": --> 유예 기간은 사용자의 사용 용량이 soft limit 용량을 넘은 후부터 적용되는 시간 제한이다. 시간은 sec(onds), min(utes), hour(s), day(s), week(s), month(s) 단위로 사용할 수 있다. "<filename>edquota -t</filename>" 명령을 실행하면 유예 기간을 보거나 수정할 수 있다. <programlisting> 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 </programlisting> </para> <para> <!-- Change the 0 days part to any length of time you feel reasonable. I personally would choose 7 days (or 1 week). --> "0 days" 부분을 적당한 기간으로 바꿔준다. 개인적으로는 7일("7 days" 혹은 "1 week")로 설정해 주었다. </para> </sect2> </sect1> <sect1> <title><!--Miscellaneous Quota Commands-->기타 Quota 명령</title> <sect2> <title>Quotacheck</title> <para> <!-- Quotacheck is used to scan a file system for disk usages, and updates the quota record file "quota.user" to the most recent state. I recommend running quotacheck at system bootup, and via cronjob periodically (say, every week?). --> <filename>quotacheck</filename>는 파일 시스템의 디스크 사용 상태를 검색하거나 quota 기록 파일인 "<filename>quota.user</filename>" 파일을 최근의 상태로 갱신하기 위해 사용한다. <filename>quotacheck</filename>를 시스템을 부팅할 때나 정기적으로(예를 들어, 일주일에 한번) cronjob을 통해서 실행할 것을 권한다. </para> </sect2> <sect2> <title>Repquota</title> <para> <!-- Repquota produces a summarized quota information for a file system. Here is a sample output repquota gives: --> <filename>repquota</filename>는 파일 시스템의 quota를 정리해서 보여준다. 다음은 <filename>repquota</filename>가 출력하는 예제이다. <programlisting> # 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 </programlisting> </para> </sect2> <sect2> <title><!--Quotaon and Quotaoff-->Quotaon과 Quotaoff</title> <para> <!-- Quotaon is used to turn on quota accounting; quotaoff to turn it off. Actually both files are similar. They are executed at system startup and shutdown. --> <filename>quotaon</filename>은 quota를 가동시킬 때 사용한다. 반대로 <filename>quotaoff</filename>는 중단시킬 때 사용한다. 실제로 이 두 화일은 비슷하다. 이것들은 시스템이 부팅되거나 중단될 때 수행된다. </para> </sect2> </sect1> </article>