• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 473
  • Last Modified:

Setting Disk Quotas - Newbie Question


I have looked at many tutorials in setting disk quotas without success.

I want to restrict folder size on /home/thisuser however I am running Gentoo Linux and I have not got "/home" on a seperate partition. I have a partition on "/" but that is the main one. I have installed the quota tool. I need to restrict /home/thisuser to 50MB and I probably have more users e.g. /home/thisuser2 that I may want to restrict in the future at different sizes.

Can anyone help me to set up this up? - I am desperate to get this working now.

Thanks in advance


  • 10
  • 9
  • 2
1 Solution


Set options in /etc/fstab

/dev/hdaX              /home       extX              defaults,usrquota,grpquota     1     2

this is important so check you /etc/fstab and add usrquota,grpquota to options.

Create the quota.user and quota.group files on top of the /home filesystem:

# touch /home/quota.user  /home/quota.group
# chmod 600 /home/quota.user  /home/quota.group

Run quotacheck to initialize the databases ( /home/quota.user  /home/quota.group ).

# quotacheck -avugm

Then verify that your quota database files have been initialized by noting that they are no longer of size zero.

# ls -al /home/quota.*

Run quotaon to enable the quota system:

# quotaon -a

Verify that your system's initialization script /etc/rc.d/rc.sysinit will turn on quotas when system boots.

if [ -x  /sbin/quotacheck ]
    echo " Checking quotas."
    /sbin/quotacheck -avug
    echo " DONE "
if [ -x /sbin/quotaon ]

echo " Turning on quotas."
       /sbin/quotaon -avug


to editing quotas for clients use commad:

# edquota <username>

Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/hdaX                        X      50000   60000       X       0        0

edit soft and hard limits.

and run

# quotacheck -avugm

spyritAuthor Commented:
Thanks for a swift reply just one minor question before I accept. I don't have /home as a seperate partition in my fstab. Do I have to create that?? Type a new line?? Other commands to make it a partition??


usualy the home partition is created separatly just because is the most inportant filesystem and also when you fill it up it does not effect your system.

I think that you have /home in / in that case enable quotas on / . But if you just instaled linux and you do not have data in it is good to make separate partition or add another hard drive and create filesystem and mount in into /home directory. :-)
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

spyritAuthor Commented:
I have been using it for some time unfortunately. Therefore I will have to enable quotas in the "/" directory I think.

I will try that and accept your answer later tonight.


You might want to consider using Webmin. Its totally fast and highly efficient for setting up disk quotas and maintaining them. It also has a number of modules to setup under the /etc/init.d for starting up quota after a server reboot. I utilize it in a heavy server (500+ users) environment and have had zero problems. Setting up disk quotas, user accounts, NFS mounts, you name it... with Webmin its a breeze!

Webmin Site: http://www.webmin.com/

-- Michael
spyritAuthor Commented:

I tried setting up those quotas. When i do the quotacheck -avug It said no quota file or something... then carried on checking the dev/hda3/ but when I check to make sure the quota.user and quota.group files ok. They are still 0. and It can't turn on the quotas because the quota files don't exist. What's wrong?

Hi Michael, I am using webmin but need to set up the quota tool and config on the disk first. Thats the problem. It won't let me do anything in webmin yet. - Thanks

where did you put files?
try to put tehm on /
did you run
better you put another HDD and copy your home directorey there and mount it into /home is more better..
Lets see what your files look like. Can you display here your /etc/fstab & /etc/mtab? Also do a quick 'ls -l' on your /home directory -- gives us a better lay of the land to see what you are seeing as well.

-- M
spyritAuthor Commented:

Here is what I have got.....

# /etc/fstab: static file system information.
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.14 2003/10/13 20:03:38 azarah Exp $
# noatime turns off atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail and tail freely.

# <fs>                  <mountpoint>    <type>          <opts>                  <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/hda1               /boot           reiserfs        noatime,notail          1 1
/dev/hda3               /               reiserfs        noatime,usrquota,grpquota                       1 2
/dev/hda2               none            swap            sw                      0 0
/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         noauto,ro               0 0
#/dev/fd0               /mnt/floppy     auto            noauto                  0 0

# NOTE: The next line is critical for boot!
none                    /proc           proc            defaults                0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
#  use almost no memory if not populated with files)
# Adding the following line to /etc/fstab should take care of this:

none                    /dev/shm        tmpfs           defaults                0 0
/dev/hdb1               /mnt/store      reiserfs        defaults                0 0

If I run quotaon I get this message....

quotaon -a
quotaon: Cannot find quota file on / [/dev/hda3] to turn quotas on/off.
quotaon: using //aquota.user on /dev/hda3 [/]: No such process
quotaon: Quota format not supported in kernel.

This is an ls -l on my /home directory

ls -l
total 0
drwxr-xr-x  2 root   root   72 Jun 29 17:55 ftp
drwxr-xr-x  6 joof   joof  208 Oct  1 23:02 joof
drwx------  3 oliver users 192 Jun 30 18:17 oliver
drwx------  2 stuart users 136 Aug  7 13:15 stuart

This is what I get doing a quota check

quotacheck -avugm
quotacheck: Cannot get quotafile name for /dev/hda3
quotacheck: Scanning /dev/hda3 [/] done
quotacheck: Checked 22846 directories and 208146 files

This is what happens doing an ls -la on the "/"

/ # ls -la
total 26
drwxr-xr-x  19 root root  528 Oct  2 21:39 .
drwxr-xr-x  19 root root  528 Oct  2 21:39 ..
-rw-r--r--   1 root root 8192 Oct  2 21:39 aquota.user
drwxr-xr-x   2 root root 3592 Aug  2 06:35 bin
drwxr-xr-x   4 root root  176 Jun 28 18:10 boot
drwxr-xr-x   1 root root    0 Jan  1  1970 dev
drwxr-xr-x  60 root root 3920 Oct  1 23:26 etc
drwxr-xr-x   6 root root  168 Oct  1 23:04 home
drwxr-xr-x   8 root root 3456 Aug  2 08:12 lib
drwxr-xr-x   8 root root  216 Sep 29 21:50 mnt
drwxr-xr-x   3 root root   96 Jun 29 08:31 opt
dr-xr-xr-x  65 root root    0 Oct  1 23:20 proc
-rw-------   1 root root    0 Oct  1 23:04 quota.group
-rw-------   1 root root    0 Oct  1 23:04 quota.user
drwx------   9 root root 1744 Oct  2 00:00 root
drwxr-xr-x   2 root root 3680 Sep 29 21:21 sbin
drwxr-xr-x   2 root root   48 Aug 11 12:03 store
drwxr-xr-x   9 root root    0 Oct  1 23:20 sys
drwxrwxrwt   8 root root 2424 Oct  2 03:13 tmp
drwxr-xr-x  13 root root  448 Jul 23 17:04 usr
drwxr-xr-x  14 root root  384 Jun 30 08:03 var

As you can see the quota.user and quota.group are still zero in file size after performing all the other stuff.

I have increased the points to 400. I hope someone can help. Thanks.


hi sprit heve look here :

my quotas:
# <file system> <mount point>   <type>  <options>               <dump>  <pass>
/dev/hda1       /               ext3    errors=remount-ro,       1      0
/dev/hda2       none            swap    sw                      0       0
/dev/hda3       /mnt/backup_hda3 ext3   errors=remount-ro       0       0
/dev/hdb1       /home           ext3    errors=remount-ro,usrquota       2       0  ->different hdd just for /home
proc            /proc           proc    defaults                0       0
/dev/fd0        /floppy         auto    user,noauto             0       0
/dev/cdrom      /cdrom          iso9660 ro,user,noauto          0       0

ls -alF *user
-rw-------    1 root     root      2097120 Oct  3 03:00 quota.user

do not try open this files

what kernel you got?
spyritAuthor Commented:

I will try that when I get back tonight.

In the meantime any other suggestions.... ideas.... as I don't have the /home partition anda reformat is not an option.

My kernel is.... Gentoo Linux - Custom Kernel


I hope this helps.

Thanks once again

spyritAuthor Commented:
All done - I think... Is there any way I can make sure it is done... like testing the limits? Thanks for all your help. I will award the points to Luxana for his swift detailed response at the start. I think the only thing missing was to mention I needed to change to single user mode which I now worked out. Thanks for helping me and providing great responses!

Can I test the quota then?? Any sort of tests or programs??


spyritAuthor Commented:

repquota / shows

repquota /
*** Report for user quotas on device /dev/hda3
Block grace time: 00:00; Inode grace time: 00:00
                        Block limits                File limits
User            used    soft    hard  grace    used  soft  hard  grace
root      -- 2711502       0       0         225079     0     0
bin       --      37       0       0              5     0     0
lp        --      13       0       0              4     0     0
named     --      21       0       0             11     0     0
mysql     --    1440       0       0            226     0     0
apache    --     296       0       0             62     0     0
postfix   --       2       0       0             13     0     0
portage   --    4193       0       0            856     0     0
stuart    --    5567       0       0            538     0     0
oliver    --  493078       0       0           2251     0     0
ldap      --       1       0       0              4     0     0
clamav    --    1398       0       0              4     0     0
joof      --   22923   45000   50000            445     0     0
#55       --    1969       0       0             74     0     0

so that looks ok

BUT! quotaon -a is doing this........

quotaon: using //aquota.group on /dev/hda3 [/]: No such process
quotaon: Quota format not supported in kernel.
quotaon: using //aquota.user on /dev/hda3 [/]: No such process
quotaon: Quota format not supported in kernel.

Why does it all go wrong for me....... :s

Please please help. I have increased points another 50


Hi spyrit,

first remove from /etc/fstab ",grpquota" we do not need enable group quotas yet and it make our life easyer at tho moment
what you get when you type :
#quotaoff -a
#quotaon -a
does you get this message again ?:
quotaon: using //aquota.user on /dev/hda3 [/]: No such process
quotaon: Quota format not supported in kernel.
spyritAuthor Commented:

Yes I do still get that message....


#modprobe -v quota_v2
and then
# quotaoff -a
# quotaon -a
spyritAuthor Commented:

I will try that as soon as I can get home....

Just as an extra - I don't know whether this helps but when I originally installed gentoo I didn't have the quota tool installed. I have used emerge quota to get the tool and install it.

Everything now works... like the commands except quotaon :s I don't have to do anything special do I, because I didn't install quota when the kernel was compiled?

I will try that command later tonight.


ok try taht but if everithing is working there is no poit to try anything...:))

spyritAuthor Commented:
Points increased another 15... thats all I have left now....

I ran that command.... here are the results.

modprobe -v quota_v2
FATAL: Module quota_v2 not found.

Hi spyrit,

modprobe -v quota_v2
FATAL: Module quota_v2 not found.

this just tell us that you do not have modul quota_v2
you said that you have your own compiled kernel so go to your kernel source and do:
# make menuconfig
# make xconfig
and see if you have enabled quotas and also see if quotas supports also Rieserfs filesystem which you have on your / directory.

spyrit ,

it seems that our Newbie Question becomes to complex problem:)))


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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