On my OpenSUSE Leap 15.3 with Samba version 4.13.4, I have a test share in a btrfs subvolume with 1GB quota, with the following config:
[global]
workgroup = HOME
passdb backend = tdbsam
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
guest account = smbguest
map to guest = Bad User
logon path = \\%L\profiles\.msprofile
logon home = \\%L\%U\.9xprofile
logon drive = P:
usershare allow guests = No
netbios name = server
wins support = No
dfree command = /usr/local/bin/df_btrfs
dfree cache time = 1
log level = 10
[test]
comment = test
inherit acls = Yes
path = /srv/samba/test
read only = No
valid users = test
vfs objects = snapper btrfs
force user = test
veto files = /.snapshots
Everything works correctly, except the disk usage. It displays the full disk usage and ignores the quota, so I used the following script and passed it to the dfree command =
option.
df_btrfs:
#!/bin/sh
# Not very efficient but its a draft
btrfs quota rescan -w $1 > /dev/null
STR=$(btrfs qgroup show -rF --raw $1 | tail -1)
NUM1=$(echo $STR | cut -d " " -f 4)
NUM2=$(echo $STR | cut -d " " -f 2)
SIZE=$(expr $NUM1 / 1024)
USED=$(expr $NUM2 / 1024)
AVAIL=$(expr $SIZE - $USED)
echo $SIZE $AVAIL
And when I execute grep "df_btrfs" /var/log/samba/log.smbd
this is the output of the logs:
server:/usr/local/bin # grep "df_btrfs" /var/log/samba/log.smbd
doing parameter dfree command = /usr/local/bin/df_btrfs
doing parameter dfree command = /usr/local/bin/df_btrfs
sys_disk_free: Running command '/usr/local/bin/df_btrfs .'
sys_popenv: ERROR executing command '/usr/local/bin/df_btrfs': Permission denied
sys_disk_free: file_lines_load() failed for command '/usr/local/bin/df_btrfs .'. Error was : No child processes
But these are my scripts permissions:
server:/usr/local/bin # ll
total 4
-rwx------ 1 root root 269 Aug 30 18:07 df_btrfs
What am I missing here? According to the manual the permissions are set up correctly.
Every bit of help is greatly appreciated.
Thanks in advance!