* Linux 2.0 + Quotas Howto - V0.1 Alpha
@ 1996-07-21 4:00 Peter Corcoran
0 siblings, 0 replies; only message in thread
From: Peter Corcoran @ 1996-07-21 4:00 UTC (permalink / raw)
-----BEGIN PGP SIGNED MESSAGE-----
Here is a first draft of a Linux 2.0 + Quotas mini-Howto. I knocked
this together because there doesn't seem to be much docs on quotas
and there is a reasonable amount of newsgroup traffic looking for
info on setting it up ...
Comments, criticisms and contributions to "pcor@eek.ucg.ie" ...
- ----------------------------------------------------------------------
Quotas + Linux 2.0 mini- Howto
Peter Corcoran <pcor@eek.ucg.ie>
Jul 1996
1. Why this HOWTO?
Getting Quotas to work with Linux isn't very difficult, but there
isn't much by way of docs available to tell you how to do it.
I also noticed a reasonable of newsgroup traffic from people asking
about Quotas, but most of the replies tend to be quite terse.
This is intended as a first-pass at a mini-Howto on this topic - I
would invite additional contributions as my own experience is limited
to RedHat and kernel version 2.0.x. If you have any contributions mail
them to me at the above address.
This document will outline:
* What you need to run Quotas for kernel versions 2.0.x.
* Where to get the Quotas software; how to install it.
* A summary of what commands you've installed and how to use them.
* Some simple examples of using Quotas.
2. Requirements
There are three main steps to get Quotas working. Firstly you need the
2.0 kernel. Secondly you need the Quotas package. Thirdly you need to
do some basic system-level configuration. Lets take these in turn:
2.1 The Kernel
I will assme you have kernel 2.0.x running on your machine. If you have
got RedHat 3.0.3 them check out the upgrade proceedure at their Web site.
When upgrading the rpms don't do "rpm -Uvh *.rpm" as RedHat advise - you
need to upgrade the "initscripts" rpm first or some of the others won't
install. If you haven't got RedHat but have kernel 2.0.x then most of this
will still apply. It should also work with 1.3.xx kernels, but I think you
have to get some patches for some of the earlier 1.3 series. Mail me if you
have experience with this.
The next step is to compile a kernel with Quotas support. I assume you've
already compiled a suitable kernel for your machine; if you've also added in
support for Quotas you are done and can skip to the next step. If not, go into
/usr/src/linux and do a "make config". In the latter stages of the configuration
proceedure you will be asked if you want Quotas support - say yes. Do the usual
make clean ; make dep ; make zImage, or whatever and get a cup of coffee while
you wait. If everything goes OK copy the new image to "vmlinuz.new"; RUN LILO
and reboot - you are done with step I.
compiles cleanly you're finished with step I;
2.2 The Quotas Package
The second thing you need is the Quotas package. If you've got RedHat this bit
is easy - go to "ftp.redhat.com/pub/contrib/RPMS" and download the basic "quota-
1.xx-x.i386.rpm" package. As of writing the current version is 1.52-3. Now do
the usual "rpm -ivh quota-1.52-3.i386.rpm" and everything should be dandy. You
can skip to step III.
If you don't have RedHat you may be able to install using rpm. If you can, do it
because the non-rpm version of Quotas is a bit short on docs and doesn't conpile
unless you mess around with .h files. If you want the source version go to sunsite
or your local mirror and look in the "system/admin" directory where you should find
"quota-1.52-3.tgz" or whatever. There may also be an older "quota+acct" package -
this is quite old and I don't know if it is any use, but it does have better docs
than the source distribution of Quotas. Now I couldn't get the source distribution
to compile, but I have seen newsgroup postings advising that you must copy the
"maintent.h" file into "/usr/src/include" in order to get it to compile. I have a
"maintent.h" file already in "/usr/src/include" which is substantially different
from the one included with the Quotas source distribution so if you do take this
approach I would suggest backing up your old "maintent.h" file.
2.3 Configuring Quotas
If you've got past steps I & II you should now have a Quota-enabled kernel and a
set of binaries for manipulating, editing and tracking user and group quotas. The
binaries from quotas live in "/usr/sbin" and you should also have man pages installed
so that you can really get into the nitty-gritty if you want. I'll list the binaries
in section 3, however, if you just want to get things running you'll need to do a
little bit-een (Irish colloquialism, sorry ;-) of basic system configuration.
First you want to tell Quotas which disk partitions have quota checking enabled on
them. You do this in "/etc/fstab" with something like:
/dev/hda4 /home ext2 defaults,usrquota 1 2
which turns on user level quota checking on my home partition. Naturally you will
have to unmount and remount your partition to enable Quotas. But read the next bit
first, because its probably easier to make all the changes and then reboot.
Incidently if you wanted grouplevel quotas as well you'd have "defaults,usrquota,
grpquota" in the above.
Next you want Quotas to start up when you boot the system. So go to your "/etc/rc.d"
directory and insert in your "rc.local" script the following (if you're using some
other distribution you may not have an rc.local):
/usr/sbin/quotacheck -av[ug]
/usr/sbin/quotaon -av[ug]
Now "quotacheck" starts checking user/group quotas against actual file usage; if you
don't start it up you will find that the Quotas system doesn't update file usage
which can be problematic ;-). And I'm sure you can guess what "quotaon" does ;-).
The -a option selects all active disk partitions with Quota-enabled filesystems; the
-v is for verbose mode. The -u option is user-level quota checking (default); the -g
selects group level checking.
3. Whats in Quotas
This is a brief summary of what is in the Quotas package - it probably isn't
complete, but these are the bits I've figured out. Let me know if there is other
stuff that should go in here. Also this is terse - read the man pages for details.
edquota -[avug] Edit a user's quota; starts a vi session to set a
new quota or edit existing user quotas; data is
kept in "/partition/quota.user" or "/partition/quota.grp"
quotaon -[avug] Turn on quotas for all [-a] or for a particular user
or group; [-v] for verbose mode.
quotaoff -[avug] Turn off quotas for all [-a] or for a particular user
or group; [-v] for verbose mode.
quotacheck -[avug] Enables checking of user/group quotas. If you don't do
this you will get some very funny results; file usage
won't stay updated, etc ...
repquota -[avug] Reporting on Quotas by users/groups. This is the easiest
way for a sysadmin to keep a check on who is doing what.
4. Some Quick 'n Dirty Examples
You should have enough in the above to get started, but its always nice to see how
someone else has done it so I'm going to throw in a couple of examples from my own
setup to get you started:
I've set up Quotas only on my home partition. Here is a typical listing from
"repquota":
Block limits File limits
User used soft hard grace used soft hard grace
root -- 14 0 0 0 0 0
bin -- 12 0 0 1 0 0
pcor -- 11006 20000 25000 73 100 120
joe -- 5843 10000 12000 23 50 60
kev -- 33 10000 12000 26 50 60
So I've given a typical user a "soft" quota of 10 MB, and a "hard" limit of 12 MB.
They get "soft" and "hard" file limits of 50 and 60 each. I don't know how practical
these limits are, as this is a new server I'm in the process of comissioning; comments
appreciated.
Here is what my "/etc/rc.d/rc.local" looks like:
#!/bin/sh
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
if [ -f /etc/redhat-release ]; then
R=$(cat /etc/redhat-release)
else
R="release 3.0.3"
fi
arch=$(uname -a)
a="a"
case "_$arch" in
_a*) a="an";;
_i*) a="an";;
esac
/usr/sbin/quotacheck -av
/usr/sbin/quotaon -av
# This will overwrite /etc/issue at every boot. So, make any changes you
# want to make to /etc/issue here or you will lose them when you reboot.
echo "" > /etc/issue
echo "WuzWuz running Red Hat Linux $R" >> /etc/issue
echo "Kernel $(uname -r) on $a $(uname -m)" >> /etc/issue
cp -f /etc/issue /etc/issue.net
echo >> /etc/issue
Note the order of "quotacheck" and "quotaon" - this is, apparently, quite important.
Finally note my fstab:
#
# /etc/fstab
#
# You should be using fstool (in the control-panel) to edit this!
#
/dev/hda1 / ext2 defaults 1 1
/dev/hda4 /home ext2 defaults,usrquota 1 2
/dev/hdb4 /home/httpd ext2 defaults 1 2
/dev/hdb2 /home/samba ext2 defaults 1 2
/dev/hda3 /usr ext2 defaults 1 2
/dev/hdb3 /usr/nfs/usr ext2 defaults 1 2
/dev/hda2 /var ext2 defaults 1 2
#
# proc filesystem
#
/proc /proc proc defaults 0 0
/dev/fd0 /mnt/floppy ext2 defaults,noauto 0 0
/dev/cdrom /mnt/cdrom iso9660 ro,noauto 0 0
#
# Swap partitions
#
/dev/hdb1 none swap sw
Well, thats about it. As I indicated above this is a first pass at a Quotas mini-Howto.
It is currently RedHat centric, because my experience only covers RedHat. Naturally
I would welcome contributions, comments, and constructive criticism. I threw this
together in a hurry, because I couldn't find much by way of docs on Quotas and had to
figure most of this out myself. Hopefully you will find it useful - let me know. Also
if you want to contribute/co-author/maintain this document let me know.
Peter Corcoran, Galway, Ireland, 15/7/96.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i
iQCVAwUBMfJi6YQRll5MupLRAQHG1AQArXliWGd7DfBW8idjeN1kk6FZKOU8dciC
T12EAPGOvRjcG+5xKwl/T4WDN77/vqNZkp4VLrDS6IKe18PhMeHqQ7QljnVtcuJ+
Ci1iODIu8vt1Emdu5Bdey4DljyalOJv/igk65Ai88iBwdaR9yIjA5297A8r+nySC
G6o+O6rxQX8=
=Kslc
-----END PGP SIGNATURE-----
--
This article has been digitally signed by the moderator, using PGP.
Finger wirzeniu@kruuna.helsinki.fi for PGP key needed for validating signature.
Send submissions for comp.os.linux.announce to: linux-announce@news.ornl.gov
PLEASE remember a short description of the software and the LOCATION.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-07-21 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-07-21 4:00 Linux 2.0 + Quotas Howto - V0.1 Alpha Peter Corcoran
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox