Setting Filesystem Quotas on Ubuntu 22.04

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

In this guide, learn how to use quotas to limit the amount of disk space a user or group can use on a filesystem.

The quota subsystem allows system administrator to set limits on the space used by each file or directory for users or groups.

Before You Begin

  • Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.

  • Complete the sections of our Securing Your Server to create a standard user account, harden SSH access and remove unnecessary network services.

  • Update your system:

      sudo apt-get update && sudo apt-get upgrade
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, you can check our Users and Groups guide.

Install the Quota Tools

  1. Install the quota command line tools using apt package manager:

    sudo apt update
    sudo apt install quota
  2. Verify that the tools are installed:

    quota --version
  3. Verify that you have the required kernel modules to support quota management:

    find /lib/modules/ -type f -name '*quota_v*.ko*'

    The output is similar to:


    Make a note of the version of the kernel listed in the file path.

    If there are no kernel modules, you can install them using sudo apt install linux-image-extra-virtual.
  4. Update the mount options for the filesystem by updating the corresponding entry in /etc/fstab configuration file, using an editor of your choice to:

    File: /etc/fstab
        /etc/fstab: static file system information.
        # Use 'blkid' to print the universally unique identifier for a
        # device; this may be used with UUID= as a more robust way to name devices
        # that works even if disks are added and removed. See fstab(5).
        # <file system> <mount point>   <type>  <options>       <dump>  <pass>
        /dev/sda        /               ext4    usrquota,grpquota 0     1
        /dev/sdb        none            swap    sw                0     0

    The options usrquota and grpquota enables quotas on the filesystem for both users and groups. Ensure that you add the new options separated by a comma and no spaces.

  5. Remount the filesystem with the new options:

    sudo mount -o remount /
  6. Verify that the new options are used to mount the filesystem:

    cat /proc/mounts | grep ' / '

    The output is similar to:

    /dev/sda / ext4 rw,relatime,quota,usrquota,grpquota,errors=remount-ro 0 0
  7. Create the aquota.user, and files that contain information about the limits and the usage of the filesystem:

    sudo quotacheck -ugm /

    The option u creates the aquota.user file for users, the g option creates the file groups, and the m option disables remounting the filesystem as read-only. You can view the quota files that are created using the ls / command.

  8. Add the quota modules to the Linux kernel using the <kernel_version> that you made a note of:

    sudo modprobe quota_v1 -S <kernel_version>
    sudo modeprobe quota_v2 -S <kernel_version>
  9. Turn on the quota system using:

    sudo quotaon -v /

    The output is similar to

    quotaon: Your kernel probably supports ext4 quota feature but you are using external quota files. Please switch your filesystem to use ext4 quota feature as external quota files on ext4 are deprecated.
    quotaon: using // on /dev/sda [/]: Device or resource busy
    quotaon: using //aquota.user on /dev/sda [/]: Device or resource busy

    You can ignore the message about switching the filesystem to use ext4 quota feature.

Configure Quotas for a User

  1. To edit quota for the sudo user <example_user> that you added when securing your Linode compute instance, enter the following:

    sudo setquota -u <example_user> 100M 110M 0 0 /
  2. Check the new quota for the user:

    sudo quota -v <example_user>

    The output is similar to:

       Disk quotas for user rajie (uid 1000):
       Filesystem   space   quota   limit   grace   files   quota   limit   grace
        /dev/sda     40K    100M     110M               8       0       0
  3. You can generate a report for the quota usage of all users on a filesystem:

    sudo repquota -s /

    The output is similar to:

    *** Report for user quotas on device /dev/sda
    Block grace time: 10days; Inode grace time: 10days
                            Space limits                File limits
    User            used    soft    hard  grace    used  soft  hard  grace
    root      --   3746M      0K      0K           119k     0     0
    man       --   1460K      0K      0K            155     0     0
    systemd-timesync --      4K      0K      0K              2     0     0
    syslog    --  23588K      0K      0K              7     0     0
    _apt      --     36K      0K      0K              6     0     0
    tss       --      4K      0K      0K              1     0     0
    pollinate --      4K      0K      0K              2     0     0
    landscape --      8K      0K      0K              3     0     0
    fwupd-refresh --      4K      0K      0K              1     0     0
    example_user     --     24K    200M    220M              8     0     0

If you want your users to be able to check their quotas, even if they do not have sudo access, then you need to give them permission to read the quota files you created. Create a users group, make those files readable by the users group, and then make sure all your users are added in the group.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This page was originally published on

Your Feedback Is Important

Let us know if this guide was helpful to you.

Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.