---
# System prepended metadata

title: BeeGFS Quota Tests

---

# BeeGFS Quota Tests

-----

## Test Environment

* Host `vm-master`
  * CentOS Linux 8.4.2105
    * Kernel 4.18.0-305.7.1.el8_4.x86_64
    * `firewalld` disabled
    * SELinux disabled
    * Package group "Development Tools" installed
      * gcc 8.4.1 20200928 (Red Hat 8.4.1-1)
  * BeeGFS 7.2.3
    * Client
* Host `vm-storage`
  * CentOS Linux 8.4.2105
    * Kernel 4.18.0-305.7.1.el8_4.x86_64
    * `firewalld` disabled
    * SELinux disabled
    * Package group "Development Tools" installed
      * gcc 8.4.1 20200928 (Red Hat 8.4.1-1)
  * BeeGFS 7.2.3
    * Metadata (ext4 filesystem)
    * Storage (xfs filesystem)

-----

## Key Points during Setup

From BeeGFS documentation:

> BeeGFS quota management relies on quota data provided by the **underlying file systems of storage server targets**.
>
> ...
>
> Quota tracking is designed to generally work with any underlying local file system on the storage servers that supports user and group quota ... but has only been **fully tested** with **ext4**, **XFS**, and **ZFS**.

For **ext4** filesystem, use the mount options `usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv1`.

For **XFS** filesystem, use the mount options `uqnoenforce,gqnoenforce`.

References:
* [BeeGFS Quota Management](https://doc.beegfs.io/latest/advanced_topics/quota.html)
* [ext4 Manual Page](https://man7.org/linux/man-pages/man5/ext4.5.html#MOUNT_OPTIONS)
* [xfs Manual Page](https://man7.org/linux/man-pages/man5/xfs.5.html#MOUNT_OPTIONS)

```
[alice@vm-storage ~]$ lsblk -f
NAME        FSTYPE      LABEL UUID                                   MOUNTPOINT
sda
├─sda1      vfat              E149-39FC                              /boot/efi
├─sda2      xfs               a4a9d540-ca25-4e02-96b5-368b4fbab172   /boot
└─sda3      LVM2_member       ZC7437-RiWy-vFcK-nvee-2SPd-49l1-2Eo5TN
  ├─cl-root xfs               ea6f8c18-e737-4566-9a1d-178ddaba6c81   /
  └─cl-swap swap              6b1ae7f3-9470-46d5-a1e1-3047c06ca3df   [SWAP]
sdb
├─sdb1      ext4              dfd7b4e8-24bd-475e-b6eb-834959ff9ae3   /mnt/beegfs/meta
└─sdb2      xfs               e4045e0f-dc7b-4fe7-ae01-fbfad06881ef   /mnt/beegfs/stor
[alice@vm-storage ~]$ cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Jul  2 16:26:04 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/cl-root     /                       xfs     defaults        0 0
UUID=a4a9d540-ca25-4e02-96b5-368b4fbab172 /boot                   xfs     defaults        0 0
UUID=E149-39FC          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
/dev/mapper/cl-swap     none                    swap    defaults        0 0
UUID=dfd7b4e8-24bd-475e-b6eb-834959ff9ae3 /mnt/beegfs/meta ext4 defaults,nofail 0 0
UUID=e4045e0f-dc7b-4fe7-ae01-fbfad06881ef /mnt/beegfs/stor xfs  defaults,uqnoenforce,gqnoenforce,nofail 0 0
```

-----

## Results

```
[alice@vm-master quota-test]$ id
uid=1000(alice) gid=1000(alice) groups=1000(alice),10(wheel)
[alice@vm-master quota-test]$ df -hT
Filesystem          Type      Size  Used Avail Use% Mounted on
devtmpfs            devtmpfs  858M     0  858M   0% /dev
tmpfs               tmpfs     877M     0  877M   0% /dev/shm
tmpfs               tmpfs     877M   17M  860M   2% /run
tmpfs               tmpfs     877M     0  877M   0% /sys/fs/cgroup
/dev/mapper/cl-root xfs        28G  3.0G   25G  11% /
/dev/sda2           xfs      1014M  254M  761M  25% /boot
/dev/sda1           vfat      599M  7.3M  592M   2% /boot/efi
vm-storage:/nfsopt  nfs4       28G  3.0G   25G  11% /mnt/opt
beegfs_nodev        beegfs     28G  232M   28G   1% /mnt/beegfs
tmpfs               tmpfs     176M     0  176M   0% /run/user/1000
[alice@vm-master quota-test]$ pwd
/mnt/beegfs/quota-test
[alice@vm-master quota-test]$ beegfs-ctl --getquota --defaultlimits

Quota information for storage pool Default (ID: 1):

user size limit:        1024.00 MiB
user chunk files limit: unlimited
group size limit:       unlimited
group chunk files:      unlimited

[alice@vm-master quota-test]$ ls -l
total 0
[alice@vm-master quota-test]$ dd if=/dev/zero of=./zeros.bin bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.58403 s, 192 MB/s
[alice@vm-master quota-test]$ ls -l
total 1048576
-rw-rw-r-- 1 alice alice 1073741824 Jul  8 01:40 zeros.bin
[alice@vm-master quota-test]$ beegfs-ctl --getquota --uid alice

Quota information for storage pool Default (ID: 1):

      user/group     ||           size          ||    chunk files
     name     |  id  ||    used    |    hard    ||  used   |  hard
--------------|------||------------|------------||---------|---------
         alice|  1000|| 1024.00 MiB| 1024.00 MiB||        1|unlimited
[alice@vm-master quota-test]$ dd if=/dev/zero of=./zeros_.bin bs=1024 count=1024
dd: error writing './zeros_.bin': Disk quota exceeded
dd: closing output file './zeros_.bin': Disk quota exceeded
```

-----

## Summary

Yes, it works!
