[Samba] Samba dfree command reports zero byte to Windows

Keram Yasin keramyasina at gmail.com
Tue Sep 12 08:10:46 UTC 2023


Dear Samba Team Member,

My samba server is configured as per user directory sharing server. Each
user has access to his/her home directory only. To restrict some user to
occupy all of the disk space, I setup quota on each user's home directory.
The quota is enabled by btrfs filesystem sub-volumes. To make things clear
for everyone to know how much space they have and how much space is used, I
used dfree command to get the disk usage of each users. The dfree command
is tested and works well when the user home directory is passed as the
argument. for example:
/path/to/dfree /home/user

The Samba config file is attached to this email. The content of the shell
script is as following:

#!/usr/bin/sh
/bin/echo "Hello World" >> /var/lib/samba/bin/debug.txt
STR=$(/usr/sbin/btrfs qgroup show -rF --raw "$PWD" | /usr/bin/tail -1)
SIZE=$(/usr/bin/expr `/bin/echo $STR | /usr/bin/cut -d \  -f 4` / 1024)
USED=$(/usr/bin/expr `/bin/echo $STR | /usr/bin/cut -d \  -f 2` / 1024)
AVAIL=$(/usr/bin/expr $SIZE - $USED)
/bin/echo $SIZE $AVAIL
# /bin/echo 10240 1024

The problem is when I test the script with Samba by logging in from another
Windows PC, disk added to Windows network drive has 0 byte size and zero
byte available. I tried to debug the dfree shell script by echoing the
input argument to a debug file, but nothing is saved to debug file. But I
am sure that Samba executed the dfree file. When I comment all the lines
except the last line(echoes constant disk numbers), the size is displayed
correctly on Windows PC.

Can you please tell me what is the correct way to debug above script and
why It reports 0 byte disk size and 0 byte used to Windows PC? Thank you in
advance.

Best Regards,
Keram Yasin


More information about the samba mailing list