How To Enable User and Group Quotas - DigitalOcean
How To Enable User and Group Quotas - DigitalOcean
How To Enable User and Group Quotas - DigitalOcean
Contents
By Jan Stevens
Become an author
Status: Deprecated
This article is deprecated and no longer maintained.
Reason:
The information in this article is out of date and untested. More recent information
about quotas is listed below.
See Instead:
How To Set Filesystem Quotas on Ubuntu 18.04 or Debian 9.
Introduction
This guide assumes that a droplet with user accounts has already been created. Most
of the time, user quotas are applied to FTP or SFTP users, but it's possible to apply this
to any system user. Notice that it's not possible to use VSFTP's virtual user feature with
quotas – the users should exist on the system!
Quotas are used to limit the amount of disk space a user or group can use on the VPS.
There are generally two different methods of managing quotas: first, an empty file
system can be created and mounted for a specific user. An advantage of this method is
Sign
thatupno
foradditional
our newsletter. Get the latest
package tutorials on
is required. SysAdmin
Second, theand open source
quota topics.
tool can be used to ×
Enter your email address Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 1/14
8/20/2019 How To Enable User and Group Quotas | DigitalOcean
dynamically manage the disk quota of a user or a group. A big advantage is the
possibility to change quotas on the fly without any complicated disk resizing.
This guide mainly focuses on the creation of user specific quotas; however, all the
commands are exactly the same for group quotas. Instead of a user name, a group
name can be used in the described commands.
Installing Quota
This guide starts by installing the quota program using the following command:
The mount options of the file system need to be edited before user specific quotas
can be used. The mount file fstab needs to be opened for editing using the following
command:
The quotas are enabled by adding a usrquota and/or grpquota to the mounting
options of the main hard disk. When using ursquota, the quotas are only enabled on
specific users. The grpquota option allows for quotas on user groups.
Both options can be independently added depending on the desired result. The fstab
file should be edited as follows for enabling user quotas (for group quotas add
grpquota ).
Save the file and enable the new mount options by remounting the file system as
follows:
mount -o remount /
Sign up for our newsletter. Get the latest tutorials on SysAdmin and open source topics. ×
Enter your email address Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 2/14
8/20/2019 How To Enable User and Group Quotas | DigitalOcean
The following command will create a new quotas file in the root directory of the file
system. This is an index file used by the quota tool for keeping track of the user's disk
size. It also contains the user limits and configured options.
quotacheck -cum /
1. The c parameter indicates the creation of a new file, overwriting any previous files.
2. The u parameter indicates that a new user index file should be created. To also create
a group index file, add the g command in the previous command.
3. The m parameter indicates that no read-only mount of the complete file system is
required to generate the different index files.
Because the m parameter is used, it's possible that a small mismatch happens in the
actual specific user disk size and the calculated disk size by the quota program. Make
sure that no user is currently uploading files to the server when running the previous
command to minimize a possible mismatch.
The following command announces to the system that disk quotas should be enabled
on the desired file system.
quotaon /
A similar command can be used to turn off disk quota checking, thus disabling the
quotas for the different users and groups.
quotaoff
edquota ftpuser
1. Indicates the name of the file system that has a quota enabled
3. Indicates the soft block limit for the user on the file system
4. Indicates the hard block limit for the user on the file system
6. Indicates the soft inode limit for the user on the file system
7. Indicates the hard inode limit for the user on the file system
The blocks refer to the amount of disk space, while the inodes refer to the number of
files/folders that can be used. Most of the time the block amount will be used in the
quota.
The hard block limit is the absolute maximum amount of disk space that a user or
group can use. Once this limit is reached, no further disk space can be used. The soft
block limit defines the maximum amount of disk space that can be used. However,
unlike the hard limit, the soft limit can be exceeded for a certain amount of time. This
time is known as the grace period. More information about the grace period later in the
guide.
In the example above, a soft limit off 9,785Mb and hard limit of 10Mb are used. To see
the quota in action an FTP/SFTP transfer can be started, where multiple files will be
Sign up for our newsletter. Get the latest tutorials on SysAdmin and open source topics.
uploaded with a total size of 12 Mb for example (as long as its larger than the hard limit).
×
Enter your email address Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 4/14
8/20/2019 How To Enable User and Group Quotas | DigitalOcean
The FTP/SFTP client will indicate a transfer error, meaning that the user will be unable
to upload any files. Of course, 10Mb isn't a meaningful quota. In this guide every user
will get a soft limit of 976 Mb and a hard limit of 1Gb. The configuration looks as
follows:
For checking the quota of a specific user, the quota command can be used followed by
the user or group
quota ftpuser
Generating Reports
It is possible to generate a report from the different quotas. The following command is
used:
repquota -a
edquota -t
The command gives the following output and specifies the different time unites that
could be used. For this guide, a grace period of 7 days is used.
Conclusion
The quotas will be automatically updated and enforced when a user
transfers/creates/moves/deletes a file/folder. Remember that the quota program works
by looking at the owner or group of a specific file/folder. SSH users could escape the
quotas by changing the owner or group of their files.
By Jan Stevens
Sign up for our newsletter. Get the latest tutorials on SysAdmin and open source topics. ×
Enter your email address Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 6/14
8/20/2019 How To Enable User and Group Quotas | DigitalOcean
Related Tutorials
How to Add and Delete Users on Ubuntu 16.04
How To Download Software and Content onto your Linux VPS
An Introduction to Useful Bash Aliases and Functions
15 Comments
Leave a comment...
Log In to Comment
0 This tutorial has many typing mistakes, and doesn't work as-is.
Please revise and actually test? There shouldn't be spaces in the middle of mounting
options.
Sign up for our newsletter. Get the latest tutorials on SysAdmin and open source topics. ×
Enter your email address Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 7/14
8/20/2019 How To Enable User and Group Quotas | DigitalOcean
uname-a
vbolinsp01.domain 3.10.0-693.el7.x8664 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x8664 x8664
x8664 GNU/Linux
@joaoaamarques did you solve that? Can someone help me, please?
Thanks.
0 @Joao: What's the output of uname -a and what OS are you using?
0 @arajparaj: Simply run edquota username for each user that you want to set a quota limit to.
Sign up for our newsletter. Get the latest tutorials on SysAdmin and open source topics. ×
Enter your email address Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 8/14
8/20/2019 How To Enable User and Group Quotas | DigitalOcean
edquota habib
Editor:
but after I try to save and check the quota Habib, the results are:
1 It looks the Ubuntu 16.04 LTS image (at least the 32bit) from DO mirrors is missing the quota
module even if the config have the options for quota active.
0 The only solution to this issue is to reinstall another image of the kernel who has Quota
modules.
Reboot (preferrably from the DO console - use 'Power Off' followed by 'Power On' to allow the
hypervisor to pickup the status changes).
Then run modprobe quotav2 and modprobe quotav1 in order to get ready to run quotas and
continue with the rest of the configuration to have the quotas up and running.
0 @manyk
I needed to tweak this step: modprobe quota_v2 and modprove quota_v1 -- notice the
underscore
0 @allonhadaya
You are right. The correct form of those commands includes underline between quota and
v1/2.
Thanks for pointing that out.
0 Sadly this does not work for me, no error, but while the quota is shown, I is not enforced.
I am guessing all things like LABEL=DOROOT need to be replaced by something? If so, with
what do I need to replace it?
1 @etel
Needs updating as this does not work on Ubuntu 16.04 or 16.10, even with the extra commands
noted
Sign byour
up for other users.Get the latest tutorials on SysAdmin and open source topics.
newsletter. ×
Enter your email address Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 10/14
8/20/2019 How To Enable User and Group Quotas | DigitalOcean
root@panel:/usr/sbin# quotaon /
quotaon: using //quota.group on /dev/vda1 [/]: No such process
quotaon: Quota format not supported in kernel.
quotaon: using //quota.user on /dev/vda1 [/]: No such process
quotaon: Quota format not supported in kernel.
Thanks
BECOME A CONTRIBUTOR
Learn More
Company Products
Release Notes
Community Contact
Tutorials Support
Q&A Sales
Projects and Integrations Report Abuse
Tags System Status
Product Ideas
Sign up for our newsletter. Get the latest tutorials on SysAdmin and open source topics.
Meetups ×
Enter your email address Write for DOnations Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 13/14
8/20/2019 How To Enable User and Group Quotas | DigitalOcean
Open Source
Sign up for our newsletter. Get the latest tutorials on SysAdmin and open source topics. ×
Enter your email address Sign Up
https://www.digitalocean.com/community/tutorials/how-to-enable-user-and-group-quotas 14/14