Quota.pdf

(32 KB) Pobierz
Quota mini-HOWTO
Quota mini−HOWTO
Quota mini−HOWTO
Table of Contents
Quota mini−HOWTO. ........................................................................................................................................1
Ralf van Dooren r.vdooren@snow.nl. .....................................................................................................1
1. What is quota?. .....................................................................................................................................1
2. Requirements for quota. .......................................................................................................................1
3. Quota setup: installation and configuration. ........................................................................................1
4. Quota setup: tools. ...............................................................................................................................1
5. Miscellaneous Quota Commands. .......................................................................................................2
1. What is quota?. .....................................................................................................................................2
1.1 What is quota for?. .............................................................................................................................2
1.2 Current Status of Quota on Linux. .....................................................................................................2
2. Requirements for quota. .......................................................................................................................2
2.1 Kerne. ................................................................................................................................................2
2.2 Quota software. ..................................................................................................................................3
3. Quota setup: installation and configuration. ........................................................................................3
3.1 Patch the kerne. .................................................................................................................................3
3.2 Reconfigure your kernel. ...................................................................................................................3
3.3 Compile and install the quota softwares. ...........................................................................................3
3.5 Modify /etc/fstab. ...............................................................................................................................4
3.6 Activate the quota system. .................................................................................................................5
3.7 Add quotacheck to crontab. ...............................................................................................................5
4. Quota setup: tools. ...............................................................................................................................5
4.1 Assigning quota for a particular user. ................................................................................................5
4.2 Assigning quota for a particular group. .............................................................................................5
4.3 Assigning quota for a bunch of users with the same value. ...............................................................5
4.4 Soft Limit. ..........................................................................................................................................6
4.5 Hard Limi. .........................................................................................................................................6
4.6 Grace Period. ......................................................................................................................................6
5. Miscellaneous Quota Commands. .......................................................................................................6
5.1 Quotacheck. .......................................................................................................................................6
5.2 Repquota. ...........................................................................................................................................6
5.3 Quotaon and Quotaof.. ......................................................................................................................7
i
115286977.001.png
Quota mini−HOWTO
Ralf van Dooren r.vdooren@snow.nl
v0.5, 2003−08−09
Preamble: This document is written 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. 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.
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 kernel 2.4.21).
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.
·
·
·
4.1 Assigning quota for a particular user
·
Quota mini−HOWTO
1
115286977.002.png
Quota mini−HOWTO
·
·
1.1 What is quota for?
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.
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. Various tools are available for you to administer and automate quota policies on your
system.
1.2 Current Status of Quota on Linux
Currently, there are some major changes in the way quota works. There are two different setups. The tools
works the same, but there's a difference in used files. This document describes the setup and operation of the
_new_ quota setup. As the new setup of quota is not in the regular kernel source, this setup needs some
patching. We will describe this patching and installation of the linuxquota package. If you already have the
quota software installed on your system, you may or may not have to install this patch and package. You can
email me if you have any questions about this. I'll try to include a overview of Linux distro's and it's
implications in a later version of this document.
2.1 Kernel
The 2.x kernel source is available from http://www.kernel.org Please use an available mirror close to your
location to save bandwidth. If you have a recent version of tar, you can download the .bz2 compressed file.
Untar the kernel:
cd /usr/src
tar jxvf /path/to/linux−2.4.21−tar.bz2 − for bzip2 kernel −
tar zxvf /path/to/linux−2.4.21−tar.gz − for gzip kernel −
ln −s /usr/src/linux−2.4.21 /usr/src/linux
5. Miscellaneous Quota Commands
2
115286977.003.png
Quota mini−HOWTO
2.2 Quota software
Depending on the Linux distribution you have, you may, or may not have the quota softwares installed on
your system. The most recent version of quota is available through SourceForge and is in active development.
You can reach the homepage of the quota−development at http://www.sourceforge.net/projects/linuxquota.
3.1 Patch the kernel
Download the patch for your kernel at:
Choose your kernel version and download the patch(es). Patch your kernel with the 'patch' command. If there
is more than 1 patch for your kernel version, be sure to apply the patches in the correct order.
You can use this script ( I assume the downloaded patches are in /tmp/quota/ and the kernel has been untarred
to /usr/src/linux) :
#!/bin/sh
gunzip /tmp/quota/*.gz
cd /usr/src/linux
COUNT=`ls −1 /tmp/quota/*.diff | wc −l`
for I in `seq 1 $COUNT`
do
patch −p1 < /tmp/quota/quota−2.4.21−$I−*.diff
done
3.2 Reconfigure your kernel
Reconfigure your kernel and add quota support.
Via `make menuconfig` or `make xconfig` you can find the option to support quota under the
Filesystems−menu. You can specify extra options if you need them, like 32−bit UID support.
Save the configuration and compile the kernel. Make sure the new kernel will be used when rebooting the
system.
3.3 Compile and install the quota softwares
To be able to use all the features of the new quota system, you'll probably need to download the new
quota−package. Download the new quota software via the URL provided above.
When downloaded do:
$ gzip −dc <downloaded file> | tar xvf
$ cd quota−tools (or whatever directory the software is put in)
2.2 Quota software
3
115286977.004.png
Zgłoś jeśli naruszono regulamin