[Samba] Destination share larger than windows source

Mike Kelly mike at piratehaven.org
Fri Apr 20 12:43:47 MDT 2012

On Thu, Apr 19, 2012 at 05:21:33PM -0700, Mike Kelly wrote:
> That seems pretty strange to me, as if files are rounded up to the next
> 1k or so.
Actually, I made a mistake, that was output from du -sk, so the sizes
are larger by 1MB or so!

I got some surprising results at the byte level (du -sb), which lead me
to do a little more investigation.  Here are the files which I picked
before, these files are not special, they happened to be near the
beginning of the file and of differing sizes.  I've got thousands more
with the same allocation behavior.

I used find's printf to print %s %k %S for these files.  I'll save you
the trip to the man page:
%s  Size in bytes
%k  Amount of disk space in 1k blocks.
%S  Sparseiness:  (512*st_blocks / st_size)

As stated before I'm using ext4 with 4k blocks.

All the files have the same size in bytes, but the block allocations

          --- SA on ---   --- SA off --
  bytes     %k    %S        %k    %S    file name
-------   -------------   ------------- ----------------------------
1070035   2052  1.96372   1052  1.00674 openvpn-2.0.5-gui-1.0.3-install.exe
 197233   1028  5.3372     200  1.03837 rest2514.exe
 318391   1028  3.30622    316  1.01631 SCP Screens/Screenshot-1.png
 318229   1028  3.30791    316  1.01683 SCP Screens/Screenshot-2.png
 319245   1028  3.29738    316  1.01359 SCP Screens/Screenshot-3.png
 324373   1028  3.24525    324  1.02282 SCP Screens/Screenshot-4.png
 314324   1028  3.349      312  1.01643 SCP Screens/Screenshot-5.png
 384690   1028  2.73642    380  1.01152 SCP Screens/Screenshot-6.png
 388921   1028  2.70665    384  1.01104 SCP Screens/Screenshot-7.png
 320041   1028  3.28918    320  1.02387 SCP Screens/Screenshot.png
  28672   1028  36.7143     32  1.14286 SCP Screens/Thumbs.db

This is really interesting.  What you'd expect is that a normal file
would have a sparseiness of about 1.0, while a sparse file would be less
than 1.0.  This is what we see for the "SA off" files.  However, what we
are seeing for the "SA on" files is super-un-sparseness, the opposite of
sparsness.  They have more blocks allocated to them than they could
possibly need to store their bytes.

I think we're looking at one of three possibilities:
1) Samba is miscalculating the allocation size.
2) The kernel is miscalculating the allocation size.
3) The ext4 file system driver is miscalculating the allocation size.

Is there some other data or test results you'd like to see?



--------Mike at PirateHaven.org-----------------------The_glass_is_too_big--------

--------Mike at PirateHaven.org-----------------------The_glass_is_too_big--------

More information about the samba mailing list