Hi, my filesystems is mounted like the below df output, /share is exported in samba. Filesystem Size Used Avail Use% Mounted on /dev/sda1 50G 9.1G 41G 19% /share nfs1:/ 492T 433T 59T 89% /share/group1 If a 100G file is copied to /share/group1, samba will report the storage doesn't have enough space. I tried to use 'dfree command' to report a correct disk space, the thing is dfree command always gets parameter $1 as '.', and its pwd is always '/share'. I have no way to know which directory the user is trying to copy to. By the way, my Samba version is 4.10.2. /share/group1 is mounted as autofs. As there are many groups under /share mounted as NFS or other file systems, it is awkward to export each group as a samba share. How can I fix this? Any input is greatly appreciated! Best, Manhong
Jeremy Allison
2019-May-06 20:26 UTC
[Samba] dfree command cannot report correct disk space
On Mon, May 06, 2019 at 03:40:15PM -0400, Manhong Dai via samba wrote:> Hi, > > my filesystems is mounted like the below df output, /share is exported in > samba. > > Filesystem Size Used Avail Use% Mounted on > /dev/sda1 50G 9.1G 41G 19% /share > nfs1:/ 492T 433T 59T 89% /share/group1 > > If a 100G file is copied to /share/group1, samba will report the storage > doesn't have enough space. > > I tried to use 'dfree command' to report a correct disk space, the thing is > dfree command always gets parameter $1 as '.', and its pwd is always > '/share'. I have no way to know which directory the user is trying to copy > to.Yes, due to the symlink race issue we cd to the share directory before invoking the script. $cwd will be accurate though.> By the way, my Samba version is 4.10.2. /share/group1 is mounted as autofs. > As there are many groups under /share mounted as NFS or other file systems, > it is awkward to export each group as a samba share. > > How can I fix this? Any input is greatly appreciated!Problem is you're maintaining a fiction for the clients that all these mounts are one share. They're not. As the client thinks it's one single share then the client *knows* that doing a SMB_FS_SIZE_INFORMATION on the root of the share will give the total free space on the share. The clients don't expect that there are different dfree values below a share - they're simply not coded that way. The unit of granularity for a dfree is the share, that's a client assumption, not a server one (the server passes the path passed in by the client to the dfree call, it's just that the path is always the share root).