?
Solved

Disk Quota

Posted on 2003-03-11
3
Medium Priority
?
585 Views
Last Modified: 2013-12-27
Hy,

   I just search to limit user email account on my qmail server.  My server is a sparc with sunOS 5.9. I read something about disk quota but i didn't know how to set up the quota ! Does antone know how to set up quota ??

thanks

0
Comment
Question by:jaubm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
SumeshDaftary earned 1000 total points
ID: 8111778
The quota system (available only on ufs and vxfs filesystems) is built around limits on the two principal resources of a filesystem:

inodes
data blocks

For each of these resources, users can be assigned quotas.
Two limits can be used: hard limit and soft limit. The hard limit represents an absolute limit on the resource. Associated with the soft limit is a time limit set by the administrator. Users can exceed the soft limits for a limited amount of time.

In summary, for each user, you can assign quotas (soft and hard limits) for both blocks and inodes. Also a time limit can be set indicating how long users can exceed the soft limits.

Remember: only super-user (root) can set disk quota.

Create a quotas file
The filesystem is /acct/s1. If quotas is already there, goto the next step.
# su -
passwd:
# cd /acct/s1
# /usr/bin/touch quotas
# /usr/bin/chmod 600 quotas

Set or reset disk quota for users
Assume each student has 100MB (102400KB, we use 100000KB here) disk quota and when he uses 95MB, we need remind him that he reaches his limit. Also a student cannot create more than 10000 files (including directoies) and the soft limit is 9000. So the hard data block limit is 100000, the soft data block limit is 95000; the hard inode limit is 10000, the soft inode limit is 9000.

Set disk quota for a proto-user
Select a proto-user name. For example, csestudent.

# /usr/sbin/edquota csestudent
The editor invoked is vi unless the EDITOR environment variable specifiles otherwise.
fs /acct/s1 blocks (soft = 0, hard = 0) \
    inodes (soft = 0, hard = 0)
Modify it as below:
fs /acct/s1 blocks (soft = 95000, hard = 100000) \
    inodes (soft = 9000, hard = 10000)

Save it and quit.

Set disk quota for all users
Create the following script to set disk quota for all users:

# vi .EQ
   #!/bin/sh
   LOGINS=`/usr/bin/ls | grep -v quotas | grep -v lost+found \
           | grep -v csestudent`
   for LOGIN in $LOGINS;
   do
       /usr/sbin/edquota -p csestudent $LOGIN
   done
# /usr/bin/chmod 500 .EQ
# ./.EQ

Set soft time limit
The soft time limits are initially set to the values defined for DQ_FTIMELIMIT and DQ_BTIMELIMIT in /usr/include/sys/fs/ufs_quota.h. The default value is 7*24*60*60 -- 1 week. It is fine for general use, otherwise enter:

# /usr/sbin/edquota -t

Turn quotas on
# vi /etc/init.d/quotaon
  #!/bin/sh
  /usr/sbin/quotacheck /acct/s1
  /usr/sbin/quotaon /acct/s1            
# /usr/bin/chmod 500 /etc/init.d/quotaon
# vi /etc/rc2.d/S99quota
  #!/bin/sh
  if [ -x /etc/init.d/quotaon ]; then
      echo 'Starting quota...'
      /etc/init.d/quotaon &
  fi        
# /usr/bin/chmod 500 /etc/rc2.d/S99quota
# /etc/rc2.d/S99quota

Give warning to users
Because no warning is given when the user has exceeded the soft limit, so add the following to /etc/cshrc:
#
# check disk quota when users login
#
set groupline=`/usr/bin/groups`
if ($groupline[1] == student || $groupline[1] == students) then
    /usr/sbin/quota -v
endif
unset groupline


0
 
LVL 18

Expert Comment

by:liddler
ID: 10475145
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by  SumeshDaftary

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

liddler
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question