Quota

From LQWiki
Jump to navigation Jump to search

File system quotas refer to how much disk space a given user is allowed to have on a given partition. Quotas are established using the quota command. The purpose of quotas is to keep the users from taking up more disk space than they should properly have - for example, on a large multi-user system.

QuickStart

yast -i quota
  • Now you will need to make sure the partition you want to set a quota on is mounted with quotas enabled. For example if you want to set a quota onto the / partition you must remount this with the option usrquota or grpquota. To achieve this you could add usrquota to your /etc/fstab like this:
/dev/sda   /   ext4   acl,usrquota,user_xattr        1 1

and then reboot.

  • initialize the quota:
# quotacheck -F vfsold -m -c /
  • set a quota for a user named john:
edquota john

You will get to a new screen where you can set the quota for that user. It will look like this:

Disk quotas for user john (uid 1000):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/sda1                    104888          0          0       1117        1        1
~                                                                                               
~ 

Note that above we have set a quota of 1 for soft inode limit and hard inode limit.

To activate the quota use

quotaon
  • now test it out:
# su - john
$ touch test
$ touch test2
sda1: write failed, user file limit reached.
touch: cannot touch ‘test2’: Disk quota exceeded

TroubleShooting

Has no quota enabled

# quotaon /
quotaon: Mountpoint (or device) / not found or has no quota enabled.

Cannot find //aquota.user

# quotaon /
quotaon: cannot find //aquota.user on /dev/sda1 [/]


See also