Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disk Quotas?? 1

Status
Not open for further replies.
Apr 24, 2003
164
CA
I would like to know how to impliment Disk Quotas for specific directories... EX user1 has a limit of 10MB on his home directory and 2MB on /var/mail/user1 etc. on my Debian box (Woody) ... Any links or tips would be greatly appreciated!

--Rory--
 
Quota's can only be enabled on a per-filesystem basis. If /home and /var are on different filesystems, then you can do this. Is this the case in your situation?



Quotas
- quotas limit the amount of available space to a user or group
- quotas can only be applied to a partition
- hard limits are maximum amount of space a user can have on the system
- soft limits send a warning instructing the user to clean up while still allowing her to work, when the user reaches a specified limit
- when a user reaches a soft limit, it enters a grace period. When the grace period ends, the soft limit becomes a hard limit

Enabling Quotas
1. Edit the fourth field in /etc/fstab to include either usrquota, grpquota, or both
• /dev/hda3 /home ext2 defaults,usrquota,grpquota 1 2
2. Create the aquota.user and/or aquota.group files at the root of the partion. In this example, you would create /home/aquota.user and /home/aquota.group.
3. Set the permissions on this file 600.
4. Run ‘quotacheck -avug’ to initialize the databases (aquota.user and aquota.group)
5. Check the /home/quota.* files sizes to make sure they aren’t a size zero anymore
6. Run ‘quotaon -a’ to enable the quota system
7. Verify your systems initialization script will turn on quotas.
8. Add a command script to a system crontab directory (/etc/crontab.weekly) to execute quotacheck on a routine basis - ‘quotacheck -avug’

quota
- displays quota limits on user or group
- quota -q - shows only over-quota situations
- quota -v - displays quotas even if no storage space is allocated
- quota -u - view a users quota (only root can do this)
- quota -g - view group limits

quotaon
- enables quotas on one or more filesystems
- quotaon -a - turns quotas on for all fileystems in /etc/fstab that are marked
- quotaon -v - displays a message for each filesystem where quotas are turned on

quotaoff
- disables disk quotas on one or more filesystems
- quotaoff -a - turns quotas off for all filesystems in /etc/fstab
- quotaoff -v - displays a message for each filesystem where quotas are turned off

quotacheck
- examine filesystems and compile quota databases
- quotacheck -avug should be run on a routine basis using cron
- quotacheck -a - checks all of the quotas for the filesystems mentioned in /etc/fstab
- quotacheck -v - verbose mode

edquota
- modify user or group quotas using a text editor (vi is the default)
- edquota -u - modify user quotas (default action) - this is ignored if -g is used
- edquota -g - modify group quotas
- edquota -p - use an already configured user’s quota configuration settings and copy to other users. ie, “edquota -up olduser newuser1 newuser2 newuser3”
- edquota -t - modify soft limits

repquota
- used to report on the status of quotas
- repquota reads the quota.user and quota.group files
- repquota -a - reports on all quotas mentioned in /etc/fstab
- repquota -g - reports on group quotas
- repquota -u - reports on user quotas (default)
- repquota -v - adds a descriptive head to the output

You can use the edquota command to apply quotas to all users on your system. For example, the following command applies the quotas that you’ve already set on user “chris” to all other real users on the system…

edquota -p chris `awk -F: ‘$3 > 499 {print $1}’ /etc/passwd




ChrisP
RHCE, LPIC-1, CCNA, CNE, MCSE, +10 others
 
Wow! Thanks for the detailed response. My next question is how are users warned ...Via email. They dont' log into the system. They are mostly email users or ppl hosting their website... Disk usage is not a problem for now ... But in the future I can see it being a concern.

--Rory--
 
If /var and /home are on the same filesystem, you can't do what you asked. You'll only be able to set a disk usage quota per user or group for the entire filesystem, not per directory, unfortunately.

If the users don't have shell access, I'm not sure how they will be warned, if at all. If they log into the shell, a message will appear.


ChrisP
RHCE, LPIC-1, CCNA, CNE, MCSE, +10 others
 

repquota sends an email to users so you just need to forward their email if they don't read it.

But if /home and /var are the same file system then they must be part of the / file system? Scary.

Cheers

Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top