I'm trying to set up quotas on our server so that the user's homes will not exceed a certain size. My idea was to assign a unique group to each user and then set a quota on each of these groups, as described in the BeeGFS documentation.
I am using BeeGFS 7.4.0p1 and it seems to be configured correctly for quotas.
To test it, I wrote a little bash script to check if it is working as expected. Unfortunately, it does not. The test script looks something like this:
#!/bin/bash
# set up group and user
USER="my_user"
GROUP_NAME="${USER}_home_quota"
groupadd "$GROUP_NAME"
echo "Created group $GROUP_NAME"
usermod -a -G "$GROUP_NAME" "$USER"
echo "Added user $USER to group $GROUP_NAME"
USER_ID=$(id -u "$USER")
echo "User ID: $USER_ID"
GROUP_ID=$(getent group "$GROUP_NAME" | cut -d: -f3)
echo "Group ID: $GROUP_ID"
# set up quota on group
sudo beegfs-ctl --setquota --gid $GROUP_ID --sizelimit=10M --inodelimit=unlimited
# create and configure test dir
DIR="/home/my_user/quota_test"
rm -rf $DIR
mkdir $DIR
chmod g+s $DIR
sudo chown $USER:$GROUP_NAME $DIR
# create test folder and files
mkdir $DIR/dir1
for i in $(seq 1 15); do
head -c 1M /dev/urandom >$DIR/file$i
done
# test if quota on group works
echo "test dir:"
ls -lah $DIR
beegfs-ctl --getquota --gid $GROUP_ID
# test if quota on user works
sudo beegfs-ctl --setquota --uid $USER_ID --sizelimit=100T --inodelimit=unlimited
beegfs-ctl --getquota --uid $USER_ID
If I run this script, I get the following output:
groupadd: group 'my_user_home_quota' already exists
Created group my_user_home_quota
Added user my_user to group my_user_home_quota
User ID: 1173670758
Group ID: 1000
Using default storage pool (1)
test dir:
total 16M
drwxr-sr-x 2 my_user my_user_home_quota 0 Dec 5 11:46 .
drwx------ 26 my_user users 43 Dec 5 11:46 ..
drwxr-sr-x 2 root my_user_home_quota 0 Dec 5 11:46 dir1
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file1
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file10
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file11
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file12
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file13
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file14
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file15
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file2
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file3
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file4
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file5
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file6
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file7
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file8
-rw-r--r-- 1 root my_user_home_quota 1.0M Dec 5 11:46 file9
Quota information for storage pool Default (ID: 1):
user/group || size || chunk files
name | id || used | hard || used | hard
------------------|------||------------|------------||---------|---------
my_user_home_quota| 1000|| 0 Byte| 10.00 MiB|| 0|unlimited
Using default storage pool (1)
Quota information for storage pool Default (ID: 1):
user/group || size || chunk files
name | id || used | hard || used | hard
--------------|------||------------|------------||---------|---------
my_user |1173670758|| 37.04 TiB| 100.00 TiB|| 1777308|unlimited
Now my question:
The quota seems to be working as expected on the user (second output), but not for the group quota. Why is the size used still zero, even though I just created a bunch of files with that group?
The same answer was posted on the BeeGFS mailing list and I duplicate it here in case somebody comes across the same issue.
It turns out that the issue is related to our cluster being attached to the Active Directory (AD).
In our setup, BeeGFS is getting its users and groups from the AD of our organisation. As the example I provided earlier shows, it works fine to set the quota on a user from the AD. After some digging and some help, we found out that the quota doesn't work on local groups (i.e. groups that are not in the AD). If I instead get the quota for a group that is in the AD, it works as expected:
In that example, the group (AD_group, ID=123456789) is from the AD and everything is fine.
In case anybody knows how to use both local groups/users ans groups/users from the AD, please let me (and other users here) know.