[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 711
  • Last Modified:

using quota and specifying size for users ?

ok i got quotas working but i need to know how to setup in MB ?
if i run the command

repquota -va

i get all users with nothing setup yet 0 for all soft and hard limits
i DONT WANT SOFT LIMITS
JUST HARD to prevent over disc usage....
so it i run the command edquota -u mark

what would i specify the blocksize as ?
currently its set to 66240
which has no valuable meaning to me ?

his directory space shows this amount
 du -s /var/www/html/mark
101432  /var/www/html/mark

 du -sh /var/www/html/mark
100M    /var/www/html/mark


so i want to prevent going over 500mb total how can i do this ?

Disk quotas for user mark (uid 504):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/hdc2                     66240          0          0        466        0         0



0
aot2002
Asked:
aot2002
  • 19
  • 10
  • 9
1 Solution
 
wesly_chenCommented:
> i got quotas working i need to know how to setup in MB
block in kilobyte, 1M = 1024KB
# edquota -u mark
----
Quotas for user mark:
/dev/hda3: blocks in use: 66240, limits (hard = 102400)
         inodes in use: 466, limits (hard = 102400)
----

And in /etc/fstab
/dev/hdc3       /var    ext3    defaults,grpquota       1       1

To activate the quota software you have to reboot the system for the changes.

Repquota produces a summarized quota information for a file system:
# repquota -a

For more details, please check:
http://www.tldp.org/HOWTO/Quota.html

Wesly
0
 
wesly_chenCommented:
> Disk quotas for user mark (uid 504):
>  Filesystem                   blocks       soft       hard     inodes     soft     hard
>  /dev/hdc2                     66240          0          0        466        0         0
By the way, the quota report doesn't show the quota is enable. Do reboot after enable the quota in /etc/fstab?

Could you post
1. cat /etc/fstab
2. cd /var/www/html; df -h .
3. grep mark /etc/passwd
4. df -hl

Wesly
0
 
jlevieCommented:
"blocks" is the current usage for that user in blocks of 1Kb. Note that this can be more or less than what du reports for a user's home dir because the user may own files located in other drirectories or not all of the files in their home dir may be owned by them.

In this case du reports 100Mb, but repquota for that user only shows 66.24Mb. This indicates that some of the data in /var/www/html/mark is owned by someone else. To set a 500Mb limit you'd set say 450000 for the soft limit and 500000 for the hard limit.
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
wesly_chenCommented:
For 500MB
----
Quotas for user mark:
/dev/hda3: blocks in use: 66240, limits (soft=512000, hard = 512000)
         inodes in use: 466, limits (soft=512000, hard = 512000)
----

Wesly
0
 
aot2002Author Commented:
cat /etc/fstab


LABEL=/                 /                       ext3    defaults,usrquota,grpquota        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
/dev/hdc3               swap                    swap    defaults        0 0
/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0

[root@s root]# quotaoff /dev/hdc3

[root@s root]# cd /var/www/html; df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdc2             5.6G  3.0G  2.3G  57% /
/dev/hdc1              99M  9.0M   85M  10% /boot
none                   78M     0   78M   0% /dev/shm


[root@s html]# grep mark /etc/passwd

mark:x:504:504::/var/www/html/mark/:/sbin/nologin

 html]# df -hl
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdc2             5.6G  3.0G  2.3G  57% /
/dev/hdc1              99M  9.0M   85M  10% /boot
none                   78M     0   78M   0% /dev/shm



To answer some of your questions yes i've rebooted with the fstab changes

i tried this to turn on quotas but it only works for the /dev/hdc3 swap partition
if i try with my main partition i get this

 quotaon /dev/hdc2

quotaon: /dev/hdc2 not found in fstab






>>Note that this can be more or less than what du reports for a user's home dir because the user may own files located in other drirectories or not all of the files in their home dir may be owned by them.

Yes this is another problem as i have placed the sites entire new users under thier Group id into his main folder so everytime he adds a user in webmin for his mail they get mail stored in the a subroot of his folder.
this is why i want to allow him 500mb where right now its at 100mb



0
 
wesly_chenCommented:
> quotaon /dev/hdc2
> quotaon: /dev/hdc2 not found in fstab
How about
# quotaon /
or
modify /etc/fstab
LABEL=/                 /                       ext3    defaults,usrquota,grpquota        1 1
to
/dev/hdc2               /                       ext3    defaults,usrquota,grpquota        1 1


Wesly
0
 
aot2002Author Commented:
quotaon: using //quota.group on /dev/hdc2: Invalid argument
quotaon: using //quota.user on /dev/hdc2: Invalid argument


should i modify fstab?
0
 
wesly_chenCommented:
You mean those errors from "quotaon /"?
If yes, then please change /etc/fstab.

Wesly
0
 
aot2002Author Commented:
/dev/hdc2               /                       ext3    defaults,usrquota,grpquota        1 1


ok change it to the above and reboot is that going to make it unbootable ?
sorry but im paranoid .
i once tried changing fstab and had to run a repair disk to get back up the system.

or do you want to add that line with
LABEL=/dev/hdc2 / ext3 defaults,usrquota,grpquota 1 1
0
 
aot2002Author Commented:
You mean those errors from "quotaon /"?


YES
0
 
aot2002Author Commented:
OK i changed fstab and rebooted


 quotaon /
quotaon: using //quota.group on /dev/hdc2: Invalid argument
quotaon: using //quota.user on /dev/hdc2: Invalid argument




 cat /etc/fstab
/dev/hdc2               /                       ext3    defaults,usrquota,grpquota        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
/dev/hdc3               swap                    swap    defaults        0 0
/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0
0
 
wesly_chenCommented:
Ok, It seems like the /quota.group and /quota.user are not configured right.
You might want to post those two files.

Wesly
0
 
aot2002Author Commented:
ls
aquota.group  bin   etc     lib         mnt   root  usr
aquota.user   boot  home    lost+found  opt   sbin  var
aquota.user~  dev   initrd  misc        proc  tmp
[root@s /]# cat aquota.group
[root@s /]# cat aquota.user
ÀÙ:     :
                                                                               .#"@C0/#&p 0#°E1# %kà3g`2#                                                  cFðÎ
                          &03#
                              ðN4#°ôª
                                     5#
õòpå)
     6#




                                                                     ö  p*7#÷À8#døÒ
   9#`ùx0ú0.°-û0Tðþ ÿ3
                      ðï° Y
                           °`@P(##)#"0@*#P+#%À,#        -#À![root@s
0
 
aot2002Author Commented:
the files where from the root directory !
and the .group is empty

also they begin with the letter a not quota.group but aquota.group

does this matter?
0
 
jlevieCommented:
aquota.user & aquota.group are the correct files for a Version 2 Quota system, which is what I would expect on a system recent enough to be using EXT3 file systems. What Linux is this?

What does 'quotaon -a -p' show?
0
 
aot2002Author Commented:
quotaon -a -p
quotaon: invalid option -- p
quotaon: Segmentation fault

quota -V
Quota utilities version 3.01.
Compiled with RPC
Bugs to mvw@planets.elm.net, jack@suse.cz


ITS REDHAT 9
0
 
jlevieCommented:
Now that seems wierd. Your quotaon seems to be from 3.01, but the version furnished with RH 9 is 3.06. And I'm pretty sure that I remember it as supporting the -p option. Is this quota package one that you added to the system, and if so from where?
0
 
aot2002Author Commented:
i dont remember but i could remove it and install something you recommend a better RPM version ?
what should i look for ?
0
 
jlevieCommented:
The quota package is on your RH 9 CD's. Or you can download it from http://www.fedoralegacy.org. Since this one doesn't seem to behave in the normal manner I'd suggest that you use RedHat's copy.

When you get the right copy installed I'd recommend doing:

quotacheck -a -u
quotacheck -a -g

to rebuild the quota files. Then a 'quotaon -a -p' should work and 'quotaon -a' should also work.
0
 
aot2002Author Commented:
wget http://download.fedoralegacy.org/redhat/9/os/i386/quota-3.06-9.i386.rpm
--10:30:38--  http://download.fedoralegacy.org/redhat/9/os/i386/quota-3.06-9.i386.rpm
           => `quota-3.06-9.i386.rpm'
Resolving download.fedoralegacy.org... done.
Connecting to download.fedoralegacy.org[152.3.183.83]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 308,837 [application/x-rpm]

100%[====================================>] 308,837      210.91K/s    ETA 00:00

10:30:40 (210.91 KB/s) - `quota-3.06-9.i386.rpm' saved [308837/308837]

[root@s root]# rpm -Uvh quota-3.06-9.i386.rpm
Preparing...                ########################################### [100%]
        package quota-3.06-9 is already installed
[root@s root]# rpm -e quota
[root@s root]# rpm -Uvh quota-3.06-9.i386.rpm
Preparing...                ########################################### [100%]
   1:quota                  ########################################### [100%]
[root@s root]# quotacheck -a -u
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.
[root@s root]# quotacheck -a -g
quotacheck: WARNING -  Quotafile //aquota.group was probably truncated. Can't save quota settings...
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.
[root@s root]# quotacheck -a -g -m
quotacheck: WARNING -  Quotafile //aquota.group was probably truncated. Can't save quota settings...
[root@s root]# quotacheck -a -u
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.
[root@s root]# quotacheck -a -u -m
[root@s root]# quotaon -a -p
group quota on / (/dev/hdc2) is off
user quota on / (/dev/hdc2) is off
group quota on /boot (/dev/hdc1) is off
user quota on /boot (/dev/hdc1) is off
[root@s root]# quotaon -a -p
group quota on / (/dev/hdc2) is off
user quota on / (/dev/hdc2) is off
group quota on /boot (/dev/hdc1) is off
user quota on /boot (/dev/hdc1) is off
[root@s root]# quota -V
Quota utilities version 3.01.
Compiled with RPC
Bugs to mvw@planets.elm.net, jack@suse.cz
0
 
jlevieCommented:
How about telling us what 'type quota' shows. I suspect that there's another copy of the quota package installed in addtition to the RedHat copy. On one of my RH 9 boxes I see:

quokka> rpm -q quota
quota-3.06-9
quokka> quota -V
Quota utilities version 3.06.
Compiled with RPC
Bugs to mvw@planets.elm.net, jack@suse.cz

0
 
wesly_chenCommented:
Do
which quota
By default, it should be in /usr/bin/quota

Wesly
0
 
aot2002Author Commented:
/usr/bin/quota -V
Quota utilities version 3.06.
Compiled with RPC
Bugs to mvw@planets.elm.net, jack@suse.cz
0
 
aot2002Author Commented:
/usr/bin/quotacheck -a -u
-bash: /usr/bin/quotacheck: No such file or directory


0
 
wesly_chenCommented:
/sbin/quotacheck -a -u

/sbin/quotaon
/sbin/quotaoff

Wesly
0
 
jlevieCommented:
Please execute 'type quota' and post what it shows.

I think you'll find that there's a /usr/local/bin/quota as well as a /usr/bin/quota, or similar.
0
 
aot2002Author Commented:
type quota
quota is hashed (/usr/local/bin/quota)
0
 
aot2002Author Commented:
[root@s root]# /usr/local/bin/quota
Disk quotas for user root (uid 0): none
[root@s root]# /usr/bin/quota
Disk quotas for user root (uid 0): none
[root@s root]# /usr/local/bin/quota -V
Quota utilities version 3.01.
Compiled with RPC
Bugs to mvw@planets.elm.net, jack@suse.cz
[root@s root]# /usr/bin/quota -V
Quota utilities version 3.06.
Compiled with RPC
Bugs to mvw@planets.elm.net, jack@suse.cz
[root@s root]#
0
 
wesly_chenCommented:
So you might want to remove or rename /usr/local/quota to avoid confusion.

Wesly
0
 
jlevieCommented:
And that's what I said you'd find. Look in /usr/local and remove anything related to quota, like:

find /usr/local -name "*quota*" -exec rm {} \;

Next reboot the system and when it comes back up execute:

quotacheck -v -u -f /
quotacheck -v -g -f /

Following that 'quota -a -p' should report that both user & group quotas are enabled for the / file system and 'quotaon /' should work.
0
 
aot2002Author Commented:
im assuming you meant quotaon -a -p



 /usr/bin/quotaon -a -p
-bash: /usr/bin/quotaon: No such file or directory
[root@s root]# /sbin/quotaon -a -p
group quota on / (/dev/hdc2) is off
user quota on / (/dev/hdc2) is off
group quota on /boot (/dev/hdc1) is off
user quota on /boot (/dev/hdc1) is off
[root@s root]# /sbin/quotaon /
[root@s root]# /sbin/quotaon -a -p
group quota on / (/dev/hdc2) is on
user quota on / (/dev/hdc2) is on
group quota on /boot (/dev/hdc1) is off
user quota on /boot (/dev/hdc1) is off
[root@s root]#
0
 
aot2002Author Commented:
ok it seems to be working
but i read the quota info page stuff and it mentioned quota to be run in cron as it doesnt always do its job or something

0 3 * * 0 /sbin/quotacheck -avug

i tried running the above on command line

/sbin/quotacheck -avug
quotacheck: Quota for users is enabled on mountpoint / so quotacheck might damage the file.
Please turn quotas off or use -f to force checking.


Should i use -f with cron or how will cron run this ?
0
 
wesly_chenCommented:
-- man quotacheck ---
-f     Forces  checking  and  writing of new quota files on filesystems
              with quotas enabled. This is  not  recommended  as  the  created
              quota files may be out of sync.
-------
So don't use -f.

Wesly
0
 
jlevieCommented:
While it is possible for the information in the quota files to get out of sync with usage, in my experience this hasn't been a big problem. And, given the amount of caching that occurs on an EXT3 file system and the fact that your quotas are on the root file system, the safest approach would be a reboot occasionally to force an update of the quota files since the root file system can't be remounted in read-only mode during the quotacheck.

I'd suggest printing out the quota usage (repquota), reboot, and comparing usage maybe after a week or so to see if you have a problem. If there aren't any serious differences across a reboot wait about a month and check again. From doing that a few times you'll be able to determine if this is something that needs regular attention.
0
 
aot2002Author Commented:
ok but like i said where does cron play into this and should i create a cron script as the site says ?
0
 
jlevieCommented:
What I'm recommending is that you not attempt to run quotacheck from cron. First, in a safe way, find out if you have a problem with quota's getting out of sync with usage as I suggested above. If it turns out that you do have a problem you can then investigate how best to solve it.
0
 
aot2002Author Commented:
cool guys i want to thank you so much i just cant ask for a better group in helping me out.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 19
  • 10
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now