justlinux.com
Sun, 06-Jul-2008 12:56:10 GMT
internet.com
Forum: Registered Users: 72406, Online: 270
nhfs Here you can view your subscribed threads, work with private messages and edit your profile and preferences Registration is free! Calendar Find other members Frequently Asked Questions Search Home Home

Help File Library: Using Quota


Written By: Ralph Bagaipo

Edquota 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 comsumption limit, taking away their ability to comsume unlimited disk space on a system. Quota is handled on a per user or per group, 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 seperately.

This may help to some that wants to limit their users. What I have done in my system may help you too. Here it is.

HOW-TO use Edquota to limit your users disk-space/email.

1. First of all, you have to check if your kernel supports quota. And configure if it doesnt.(check the kernel how-to for it.). But on default install, its enabled (for most systems).

2. Then slap this to your /etc/rc.local or to wherever you put your startfile. This should be done at boot time in order for the filesystem to enable quota support.

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

# 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
fi

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

3. Next, you should enable which partition you want quota to take effect. Usually this would be /home. And sometimes, on where your emails are stored (/var/spool/mail). Say, /home is in /dev/hda1. then you should modify your /etc/fstab. It should be like this. (usrquota=userquota, grpquota=groupquota). Userquota and Groupquota is explained below.

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

    /dev/hda1      /home    ext2    defaults,usrquota,grpquota       1       1

4. next, you should create a file name quota.user and quota.group to the directory where you enabled quotas on. In this case, the /home directory.

    # touch /home/quota.user

    # touch /home/quota.group

    # chmod 600 /home/quota.user

    # chmod 600 /home/quota.group

5. REBOOT. on boot up, you should see something like Checking quotas. This may take some time. And Turning quota on.

6. You are ready to administer quotas.

7. Now, there are two ways to administer your users. Either by-user or by-group. Lets say you have the group users. you can edit quotas for group users by executing the command: (-g ; switch for edquota to edit group quotas)

#edquota -g users

or for user flar,

# edquota -u flar

(-u ; switch for edquota to edit user quotas)

and that opens quota editor on its default editor which is vi. if you want to change the default editor to other editors, say, pico(or whatever you used), then you just have to execute this before issuing edquota.

# export EDITOR=pico

# edquota -g users

and you should see a file with lines like this;

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

Quotas for group users:

/dev/hda1 blocks in use: 255924, limits (soft = 0, hard =0)

inodes in use: 990, limits (soft = 0, hard = 0)

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

If you see, there are data inside the parenthesis. Namely soft and hard.

In this portion now, I should explain Soft, Hard and Grace. By the way, these are limits.

  • Soft indicates the maximum amount of disk usage a quota user has on the specified partition.

  • Hard specifies the absolute limit on the disk usage but only when grace period is set.

  • Grace is a time limit before the soft limit is enforced for a file system with quota enabled. and is performed with the command edquota -t. and it would look like this;

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

Time units may be: days, hours, minutes, or seconds

Grace period before enforcing soft limits for users:

/dev/hda1: block grace period: 7 days, file grace period: 7 days

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

I'll explain the last line. 7 days is usually the default (in my case). You could change it to how many hours, minutes or seconds the hard limit or soft limit be enforced. Which means, that after 7 days, it should locked-up the usage of the user.

After those, you could see what youve done by issuing the command repquota -a. and you should see lines like these.

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

# 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

   flar      --    13046   10000   10000            806     0      0

   you       --   2838    5120    6400             377     0    0

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

8. Thats it!! All should be workin fine. Take a milk or beer and congratulate yourself for a job well done :o)

Note: If you're using Qmail and it's Maildir support, then it should be easy to administer the users Disk-space and Mailboxes right? Because its files and e-mails are on one directory :o) so you will just configure /home directory for your quota administration.


internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
internet.commerce
Be a Commerce Partner
Find Project Software
Promote Your Website
Best Price
Phone Cards
Online Shopping
Free Business Cards
Imprinted Promotions
GPS
Logo Design
Promotional Golf




JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM eBook: Planning a Service Oriented Architecture
IBM eBook: Choosing the Right Architecture--What It Means for You and Your Business
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Avaya Article: Using Intelligent Presence to Create Smarter Business Applications
Intel Go Parallel Article: Getting Started with TBB on Windows
Microsoft Article: 7.0, Microsoft's Lucky Version?
Avaya Article: How to Feed Data into the Avaya Event Processor
IBM Article: Developing a Software Policy for Your Organization
Microsoft Article: Managing Virtual Machines with Microsoft System Center
Intel Go Parallel Article: Intel Threading Tools and OpenMP
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Silverlight 2 App and Walkthrough: Leverage Silverlight 2 with SQL Server and XML
IBM Article: Enterprise Search--Do You Know What's Out There?
HP Demo: StorageWorks EVA4400
Microsoft Article: The Progress and Promise of Deep Zoom
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES