CentOS Stream 9
Sponsored Link

GlusterFS 10 : Set Quota2022/06/15

 
It's possible to limit Gluster volume usage or directory usage on a Gluster volume to set quota.
[1] Enable quota on taget GlusterFS volume you'd like to set.
[root@node01 ~]#
gluster volume quota vol_distributed enable

volume quota : success
[root@node01 ~]#
gluster volume info


Volume Name: vol_distributed
Type: Distribute
Volume ID: d6e5ae1f-5c36-4dbd-a937-83ee5e2dfbcb
Status: Started
Snapshot Count: 0
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: node01:/glusterfs/distributed
Brick2: node02:/glusterfs/distributed
Options Reconfigured:
features.quota-deem-statfs: on
features.inode-quota: on
features.quota: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on

# to disable, set like follows

[root@node01 ~]#
gluster volume quota vol_distributed disable

[2] Set quota to the entire volume.
# for example, set 1GB quota to the entire [vol_distributed] volume
# gluster volume quota [volume name] limit-usage [path of target directory] [hard_limit]

[root@node01 ~]#
gluster volume quota vol_distributed limit-usage / 1GB

volume quota : success
[root@node01 ~]#
gluster volume quota vol_distributed list

                  Path                   Hard-limit  Soft-limit      Used  Available  Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/                                          1.0GB     80%(819.2MB) 512Bytes 1024.0MB              No                   No

# on a client, quota size is displayed as whole filesystem size

[root@client ~]#
df -h /mnt

Filesystem                         Size  Used Avail Use% Mounted on
node01.srv.world:/vol_distributed  1.0G     0  1.0G   0% /mnt

# if you'd like to see whole disk size even on a client, not display quota size,
# turn off [quota-deem-statfs] parameter on a GlusterFS volume node

[root@node01 ~]#
gluster volume set vol_distributed quota-deem-statfs off

[3] Set quota to a directory on a volume.
# for example, set 1GB quota to [/dir01] directory on [vol_distributed] volume

[root@node01 ~]#
gluster volume quota vol_distributed limit-usage /dir01 1GB

volume quota : success
[root@node01 ~]#
gluster volume quota vol_distributed list

                  Path                   Hard-limit  Soft-limit      Used  Available  Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/dir01                                     1.0GB     80%(819.2MB)   0Bytes   1.0GB              No                   No

# on a client, quota size is displayed as whole directory size

[root@client ~]#
df -h /mnt/dir01

Filesystem                         Size  Used Avail Use% Mounted on
node01.srv.world:/vol_distributed  1.0G     0  1.0G   0% /mnt
[4] Set specific soft limit to a quota setting.
# for example, set 1GB quota to [/dir01] directory on [vol_distributed] volume and set 70% soft limit
# gluster volume quota [volume name] limit-usage [path of target directory] [hard_limit] [soft_limit]

[root@node01 ~]#
gluster volume quota vol_distributed limit-usage /dir01 1GB 70

volume quota : success
[root@node01 ~]#
gluster volume quota vol_distributed list

                  Path                   Hard-limit  Soft-limit      Used  Available  Soft-limit exceeded? Hard-limit exceeded?
-------------------------------------------------------------------------------------------------------------------------------
/dir01                                     1.0GB     70%(716.8MB)   0Bytes   1.0GB              No                   No
[5] To delete quota, run command like follows.
# for example, delete quota on [vol_distributed] volume

[root@node01 ~]#
gluster volume quota vol_distributed remove /

volume quota : success
[root@node01 ~]#
gluster volume quota vol_distributed list

quota: No quota configured on volume vol_distributed
Matched Content