Samba + exFAT : how to avoid pre-allocating when copying big files?

Namjae Jeon namjae.jeon at samsung.com
Tue Dec 8 01:54:27 UTC 2020


> Hello,
> When sending a big file (for example 2 GB) from a Windows computer to a Linux computer (with Samba
> server), then:
> * if the destination FS is ext4, NTFS, no problem
> * if the destination FS is exfat, then there is a strange delay (~30
> seconds) during which the Windows Explorer waits, before actually copying the file It seems that the
> Samba server first "preallocates" the 2GB, before accepting to start the copy from Samba client.
> Thus, 2GB (of probably null bytes?) are first written, and then, the actual file is written.
> How to avoid this effect that doubles the number of gigabytes written and doubles the transfer time?
> 
> I have already tried:
> 
>     strict allocate = no
> 
> without any success in the exfat case.
> 
> Any idea?
Windows seems to send SMB_FILE_END_OF_FILE_INFORMATION smb2 setinfo request to pre-allocate space
as much as the file size before writing the file.
samba fallback to call ftruncate if fallocate is not support in local filesystem.
I personally think that it is possible to improve the problem if exFAT support
keep size flags of fallocate(). It doesn't support yet in linux kernel exFAT,
but I have a plan. exFAT can store the number of allocated cluster size and the current file
size in metadata of file.
Unlike FAT. so it seems that the fallocate can be implemented properly in exFAT.
> 
> PS:
> * I've already tried exfat-fuse, but also exfat-nofuse, and also exfat (non
> fuse) included in Kernel 5.7, and it's the same.
> * There are many forums posts with the same problem, e.g.
> https://www.raspberrypi.org/forums/viewtopic.php?t=206866
> 
> Thanks,
> Jo





More information about the samba-technical mailing list