webcp.hostinghacks.net/slackware | quotas

home   ·.   download   ·.   install   ·.   faq   ·.   forums   ·.   contribute   ·.   change log   ·.   toolbox
SYNOPSIS:

Quota allows you to specify disk use limits on disk storage: These statistics will be managed and viewed through the webhosting control panel but first they need to be enabled in the OS.

The installation commands can be run from a Putty window in a "cut-and-paste" style layout or copied to a script. Notes on Putty best practices can be found here.

last updated: June 2005
ENABLING QUOTAS
sed -e '\/home /s/defaults/defaults,usrquota,grpquota/' /etc/fstab > /tmp/fstab
mv -f /tmp/fstab /etc/fstab
mount -o remount /home
quotacheck -acugmf
quotacheck -avugmf
QUOTAS AND THE WEB HOSTING CONTROL PANEL:
you will need to make sure that the $cfg['devhd'] setting in /home/webcp/config.php corresponds to your disk geometry. Issue 'df' to find which partition /home resides on:
# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda2              4032124    836412   2990884  22% /
/dev/hda1                77750      9136     64600  13% /boot
/dev/hda5             12926984     32828  12237504   1% /home
none                     30844         0     30844   0% /dev/shm
/dev/hda3              2016044    744592   1169040  39% /var
[root@mx2 init.d]#
Then do a reboot and watch for any errors + restart webcp and watch for any errors
OPTIONAL CONFIGURATION:

Weekly disk usage report:

cat > /etc/cron.weekly/watch.quota << "EOF"

#! /bin/sh
repquota /home | mail -s "quota report" servadmin@localhost

EOF

chmod +x /etc/cron.weekly/watch.quota
/etc/cron.weekly/watch.quota
NOTES:

Edit /etc/fstab to enable quotas. Each string of this file keeps a description of each partition for mounting and has six columns (fields):

Reboot the system - (ignore quota related errors during re-boot)

If you prefer not to reboot issue 'mount -o remount /home' instead.

Initialize the File System:

quotacheck -acugmf

Build a table of the current disk usage

quotacheck -avugmf

a - all mounted file systems checked
u - user
g - group
c - creates files
m -
f - forces checking
v - builds a table of the current disk usage

Once quotacheck has finished running, you should see the quota files corresponding to the enabled quotas in the root directory of each quota-enabled file system.

ls /home
aquota.group  aquota.user  lost+found  subzero  webcp

Manually assigning Quotas

Manually assign a quota:

setquota -u USERNAME SOFTQUOTA HARDQUOTA SOFTFILELIMIT HARDFILELIMIT -a

Use edquota to edit quotas

Quota Reporting

repquota -avug
*** Report for user quotas on device /dev/md2
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      --   15680       0       0            690     0     0       
webcp     --      20       0       0              4     0     0       
admin     --       0  153600  153600              0     0     0       
click7    --    9860       0       0             92     0     0       
stompy    --     420       0       0             30     0     0       
rabbit    --       8       0       0              0     0     0       
borneo     --      20   51200   51200              4     0     0       
brainy    --      28  153600  153600              6     0     0       
world     --  347084  409600  409600             19     0     0       
netbug    --    3608  153600  153600            322     0     0       
spore     --    1372   51200   51200             64     0     0       
frosty    --    9576  256000  256000            512     0     0       
frog      --      28       0       0              6     0     0       
#502      --      24       0       0              5     0     0       

Statistics:
Total blocks: 8
Data blocks: 1
Entries: 14
Used average: 14.000000

*** Report for group quotas on device /dev/md2
Block grace time: 7days; Inode grace time: 7days
                        Block limits                File limits
Group           used    soft    hard  grace    used  soft  hard  grace
----------------------------------------------------------------------
root      --   17024       0       0            256     0     0       
webcp     --    2636       0       0            461     0     0       
g5297742021 --    9968  153600  153600            111     0     0       
g5297775130 --     492       0       0             48     0     0       
g5297796774 --       8       0       0              0     0     0       
g8202858359 --     132       0       0             24     0     0       
g8202895520 --     144   51200   51200             27     0     0       
g8202860018 --  347168 6144000 6144000             39     0     0       
g5297767297 --    3948  153600  153600            383     0     0       
g3740450620 --    1448  153600  153600             83     0     0       
g5297730079 --    4708  256000  256000            311     0     0       
Powered By Fat Penguin Hosting   |   Disclaimer