Gluster — Directory Quotas

Ayush Ujjwal
3 min readMar 15, 2021

What is Quota?

Dictionary Meaning: 📓

A limited quantity of a particular product which under official controls can be produced, exported or imported.

In terms of storage: 💾

A quota is a fixed amount of storage that can be consumed by an individual to store data on the file system. It can be used to set storage limits on directories.

I hope so this explains well.

Quota as a feature — Gluster 🐜

Directory quotas in GlusterFS allow you to set limits on the usage of the disk space by directories or volumes. The storage administrators can control the disk space utilization at the directory and/or volume levels in GlusterFS by setting limits to allocatable disk space at any level in the volume and directory hierarchy. This is particularly useful in cloud deployments to facilitate the utility-billing model.

Levels

Quota can be set at the following levels:

  • Directory level — it limits the usage at the directory level
  • Volume level — it limits the usage at the volume level

Let’s test the feature

Prerequisites

  1. You must have a volume running on a server(s)(either distributed, replicated, or replicated distributed)
  2. You have a glusterfs-client on which you have mounted the volume.

The following two articles will help you get set up with the following prerequisites:

That’s it! Let’s go…

Enable the quota 🔘

To set the disk limits one needs to enable quota. To do so run the following command:

# gluster volume quota <VOLNAME> enable

For example: let’s consider the test volume to be tvol

# gluster volume quota tvol enable
Quota is enabled on /tvol

Disabling Quota 🔴

If you feel you don’t need a limit to be set on the disk and hence wish to disable the quota then run the following command:

# gluster volume quota <VOLNAME> disable

So for our test volume tvol we will run the following command:

# gluster volume quota tvol disable
Quota translator is disabled on /tvol

Setting or Replacing Disk Limit

You can create new directories and set the disk limits or you can set the disk limit for the existing directories. The directory name should be relative to the volume with the export directory/mount being treated as “/”.

gluster volume quota <VOLNAME> limit-usage <DIR> <HARD_LIMIT>

For example:

# gluster volume quota tvol limit-usage /data 10GB Usage limit has been set on /data

In simple words, let’s suppose you had mounted the glusterfs-client on /mnt using the following command:

[root@servera ~]# mount -t glusterfs servera:tvol /mnt/tvol

Then for setting a limit on a directory you will have to create a directory (here, data) first and then set the limit on that directory.

Steps: 🚶

  1. Go to your glusterfs-client and create a directory inside the mount-point. Here, we have /mnt/tvol as the mount-point and directory as data.
# cd /mnt/tvol && mkdir data

2. Now set the limit on data

# gluster volume quota tvol limit-usage /data 10GB 
Usage limit has been set on /data
volume quota : success

Note: You can set the limit on disk from any server among the cluster.

With this, you are ready with a volume quota enabled on your disk.

😃

Next: Advanced features in Quota

References:

--

--