Samba server and client are on the same host. Mount the samba share with the option "-o user=root,password=$testPasswd,cache=none". Use "df -h" to check the space usage. Then use fallocate to preallocate 1G file. Finally use df to check again the space usage. But it doesn't change. Test xfs filesystem. fallocate can change the space usage. # cat /etc/samba/smb.conf [cifs] path=/mnt/cifs writeable=yes # mount //localhost/cifs cifs -o user=root,password=redhat,cache=none,actimeo=0 # df -h cifs Filesystem Size Used Avail Use% Mounted on //localhost/cifs 36G 23G 13G 66% /root/cifs # fallocate -o 0 -l 2g /root/cifs/file1 # df -h cifs Filesystem Size Used Avail Use% Mounted on //localhost/cifs 36G 23G 13G 66% /root/cifs Test xfs filesystem. # mount -o loop /home/xfs.img xfs # df -h xfs Filesystem Size Used Avail Use% Mounted on /dev/loop0 1014M 40M 975M 4% /root/xfs # fallocate -o 0 -l 200M xfs/file # df -h xfs Filesystem Size Used Avail Use% Mounted on /dev/loop0 1014M 240M 775M 24% /root/xfs
There is a probably Samba server bug here - since it didn't mark the file as a sparse file (so we in the client can't know to unsparse it to fix this) but ... the easiest way to fix this is to use a recommended Samba server config setting for xfs/btrfs/ext4 which is "strict allocate = yes" in the server's smb.conf file. When I tried with that update to smb.conf - seems to work fine.
close it by comment 1.