[olug] HOWTO - Setting up quota restrictions on RH 8.0 server.

Daniel G. Linder dlinder at iprevolution.com
Wed Mar 26 21:59:58 UTC 2003


Guys,

  Here are my notes (brief, but hopefully accurate) on what I did to setup quota restrictions on the shared storage server.

  In general, the server has a large filesystem mounted under /mnt/storage that we needed to place restrictions on.  Change each occurence of "/mnt/storage" with the appropriate mount point for the filesystem(s) you are dealing with.  We decided that a 5GB limit would be acceptable -- 5GB equals "5248012 blocks" in the quota commands.  The commands I typed are listed in the order that they should be done, and each command line is preceded by "Command:".

Command: vi fstab
  Add "usrquota,grpquota" to the filesystem options:
  Old /etc/fstab line: /dev/ida/c0d1p1          /mnt/storage            ext3    defaults                        0 0
  New /etc/fstab line: /dev/ida/c0d1p1          /mnt/storage            ext3    defaults,usrquota,grpquota      0 0

Command: mount -o remount,rw /mnt/storage/
  Remount the changed filesystems so the new user and group quotas take effect.

Command: touch aquota.group aquota.user
Command: chmod 600 aquota.*
  Create the appropriate quota config files per partition and set the permissions.

Command: vi /etc/init.d/quota
Command: chmod a+rx /etc/init.d/quota
  Create the system startup "quota" command and make it executable.
[root at server1 root]# cat /etc/init.d/quota
#!/bin/sh
# From: http://www.europe.redhat.com/documentation/mini-HOWTO/Quota-4.php3
# Check quota and then turn quota on.
if [ -x /sbin/quotacheck ]
  then
    echo "Checking quotas. This may take some time."
    /sbin/quotacheck -avug
    echo " Done."
fi
if [ -x /sbin/quotaon ]
  then
    echo "Turning on quota."
    /sbin/quotaon -avug
fi

Command: vi /etc/rc.local
  Add the "/etc/init.d/quota" command to the end of the /etc/rc.local files.
  This will make the quota processes startup at reboot.

Command: quotacheck /mnt/storage/
 - OR -
Command: quotacheck -m /mnt/storage/
  Have the system check the filesystem and setup the aquota.* files.  If the quota is being enabled on the "root" (/) partit
ion, then use of the "-m" option might be required.  The first time this is run, the following warnings will appear:
[root at server1 root]# quotacheck /mnt/storage/
quotacheck: WARNING -  Quotafile /mnt/storage/aquota.user was probably truncated. Can't save quota settings...

Command: /sbin/quotaon -auvg
  Turn on the actual quota features on all filesystems.

Command: edquota -u dlinder
  Setup the soft and hard limits for "blocks" and inodes per each user.
[root at server1 root]# edquota -u dlinder
Disk quotas for user dlinder (uid 500):
  Filesystem            blocks          soft            hard     inodes     soft     hard
  /dev/ida/c0d1p1       639884       5248012         5772814        950        0        0

Command: repquota -a
  Check the current usage per user, and display the limits.
[root at server1 root]# repquota -a
*** Report for user quotas on device /dev/ida/c0d1p1
Block grace time: 00:01; Inode grace time: 00:01
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      --      40       0       0              5     0     0
dlinder   --  639884 5248012 5772814            950     0     0
user1     --  779144 5248012 5772814            887     0     0

Command: edquota -t
  Setup the grace period for soft and hard limits. (filesystem limit)
[root at server1 root]# edquota -t
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
  Filesystem            Block grace period     Inode grace period
  /dev/ida/c0d1p1                    1days                  1days


Command: quota
  Let each user check their quota usage on each filesystem.
[dlinder at server1 dlinder]$ quota
Disk quotas for user dlinder (uid 500):
     Filesystem  blocks    quota   limit   grace   files   quota   limit   grace
/dev/ida/c0d1p1  639884  5248012 5772814             950       0       0

>  
> 
> 


More information about the OLUG mailing list