153 lines
4.7 KiB
HTML
153 lines
4.7 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
<TITLE>Quota mini-HOWTO: Quota setup: installation and configuration</TITLE>
|
|
<LINK HREF="Quota-4.html" REL=next>
|
|
<LINK HREF="Quota-2.html" REL=previous>
|
|
<LINK HREF="Quota.html#toc3" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="Quota-4.html">Next</A>
|
|
<A HREF="Quota-2.html">Previous</A>
|
|
<A HREF="Quota.html#toc3">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="s3">3. Quota setup: installation and configuration</A></H2>
|
|
|
|
<H2><A NAME="ss3.1">3.1 Patch the kernel </A>
|
|
</H2>
|
|
|
|
<P>Download the patch for your kernel at:
|
|
<P>
|
|
<A HREF="ftp://atrey.karlin.mff.cuni.cz/pub/local/jack/quota/">ftp::/atrey.karlin.mff.cuni.cz/pub/local/jack/quota/</A>.
|
|
<P>
|
|
<P>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.
|
|
<P>You can use this script ( I assume the downloaded patches are in /tmp/quota/ and the kernel has been untarred to /usr/src/linux) :
|
|
<P>
|
|
<HR>
|
|
<PRE>
|
|
#!/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
|
|
</PRE>
|
|
<HR>
|
|
<P>
|
|
<H2><A NAME="ss3.2">3.2 Reconfigure your kernel</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Reconfigure your kernel and add quota support.
|
|
<P>
|
|
<P>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.
|
|
<P>
|
|
<P>Save the configuration and compile the kernel. Make sure the new kernel will be used when rebooting the system.
|
|
<P>
|
|
<H2><A NAME="ss3.3">3.3 Compile and install the quota softwares</A>
|
|
</H2>
|
|
|
|
<P>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.
|
|
<P>When downloaded do:
|
|
<HR>
|
|
<PRE>
|
|
$ gzip -dc <downloaded file> | tar xvf
|
|
$ cd quota-tools (or whatever directory the software is put in)
|
|
$ ./configure
|
|
$ make
|
|
$ su
|
|
# make install
|
|
</PRE>
|
|
<HR>
|
|
<P>
|
|
<H2><A NAME="ss3.4">3.4 Modify your system init script to check quota and turn quota on at boot</A>
|
|
time</H2>
|
|
|
|
<P>
|
|
<P>Here's an example:
|
|
<HR>
|
|
<PRE>
|
|
# 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
|
|
</PRE>
|
|
<HR>
|
|
<P>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.
|
|
<P>
|
|
<H2><A NAME="ss3.5">3.5 Modify /etc/fstab</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Partitions that you have not yet enabled quota normally look something
|
|
like:
|
|
<HR>
|
|
<PRE>
|
|
/dev/hda1 / ext2 defaults 1 1
|
|
/dev/hda2 /usr ext2 defaults 1 1
|
|
</PRE>
|
|
<HR>
|
|
<P>To enable user quota support on a file system, add "usrquota" to the fourth
|
|
field containing the word "defaults" (man fstab for details).
|
|
<HR>
|
|
<PRE>
|
|
/dev/hda1 / ext2 defaults 1 1
|
|
/dev/hda2 /usr ext2 defaults,usrquota 1 1
|
|
</PRE>
|
|
<HR>
|
|
<P>Replace "usrquota" with "grpquota", should you need group quota support
|
|
on a file system.
|
|
<HR>
|
|
<PRE>
|
|
/dev/hda1 / ext2 defaults 1 1
|
|
/dev/hda2 /usr ext2 defaults,grpquota 1 1
|
|
</PRE>
|
|
<HR>
|
|
<P>Need both user quota and group quota support on a file system?
|
|
<HR>
|
|
<PRE>
|
|
/dev/hda1 / ext2 defaults 1 1
|
|
/dev/hda2 /usr ext2 defaults,usrquota,grpquota 1 1
|
|
</PRE>
|
|
<HR>
|
|
<P>
|
|
<H2><A NAME="ss3.6">3.6 Activate the quota system</A>
|
|
</H2>
|
|
|
|
<P>To activate the quota software you have to reboot the system for the changes you have made
|
|
to take effect. The new kernel with quota support will be loaded and the startup scripts you've
|
|
just created will be executed. At first run, quotacheck will generate the appropiate files to maintain
|
|
the quota databases.
|
|
<P>
|
|
<H2><A NAME="ss3.7">3.7 Add quotacheck to crontab</A>
|
|
</H2>
|
|
|
|
<P>Although quota should work with periodical checks, it sometimes helps to run quotacheck periodically, e.g. weekly. Add the following line to your root's crontab:
|
|
<HR>
|
|
<PRE>
|
|
0 3 * * 0 /sbin/quotacheck -avug
|
|
</PRE>
|
|
<HR>
|
|
<P>
|
|
<HR>
|
|
<A HREF="Quota-4.html">Next</A>
|
|
<A HREF="Quota-2.html">Previous</A>
|
|
<A HREF="Quota.html#toc3">Contents</A>
|
|
</BODY>
|
|
</HTML>
|