[Samba] Difference between real and reported disk usage

Pieter De Wit pieter at insync.za.net
Mon Dec 17 02:54:21 MST 2012


On 17/12/2012 21:07, Berni CED wrote:
> Berni Ced <ced <at> bernispa.com> writes:
>> For example, i've analized the data copied with strict allocation
>> activated and i've found that Windows Server 2008 make files space
>> allocation in 1024 kiB blocks.
> Err, i meant Windows Server 2003, not 2008.
>
> In the meantime i've tested that Windows 7 behave as Windows Server 2003.
> Here are the results of the test i've mentioned in my previous message:
>
> Files copied from Windows 2000 Pro:
> # ls -lks w2000/
> total 317572
>    1028 -rwxrwx--x 1 root root   1024 Dec 16 18:41 001M.txt
>    1032 -rwxrwx--x 1 root root   1025 Dec 16 18:49 001M1k.txt
>    2052 -rwxrwx--x 1 root root   2048 Dec 16 18:42 002M.txt
>    2056 -rwxrwx--x 1 root root   2049 Dec 16 18:50 002M1k.txt
>    3076 -rwxrwx--x 1 root root   3072 Dec 16 18:42 003M.txt
>    3080 -rwxrwx--x 1 root root   3073 Dec 16 18:50 003M1k.txt
>    4100 -rwxrwx--x 1 root root   4096 Dec 16 18:42 004M.txt
>    4104 -rwxrwx--x 1 root root   4097 Dec 16 18:50 004M1k.txt
>    5124 -rwxrwx--x 1 root root   5120 Dec 16 18:42 005M.txt
>    5128 -rwxrwx--x 1 root root   5121 Dec 16 18:51 005M1k.txt
>    6148 -rwxrwx--x 1 root root   6144 Dec 16 18:42 006M.txt
>    6152 -rwxrwx--x 1 root root   6145 Dec 16 18:51 006M1k.txt
>    7172 -rwxrwx--x 1 root root   7168 Dec 16 18:43 007M.txt
>    7176 -rwxrwx--x 1 root root   7169 Dec 16 18:51 007M1k.txt
>    8196 -rwxrwx--x 1 root root   8192 Dec 16 18:43 008M.txt
>    8200 -rwxrwx--x 1 root root   8193 Dec 16 18:51 008M1k.txt
>    9220 -rwxrwx--x 1 root root   9216 Dec 16 18:43 009M.txt
>    9224 -rwxrwx--x 1 root root   9217 Dec 16 18:51 009M1k.txt
>   10244 -rwxrwx--x 1 root root  10240 Dec 16 18:43 010M.txt
>   10248 -rwxrwx--x 1 root root  10241 Dec 16 18:52 010M1k.txt
> 102404 -rwxrwx--x 1 root root 102400 Dec 16 18:44 100M.txt
> 102408 -rwxrwx--x 1 root root 102401 Dec 16 18:52 100M1k.txt
>
> # du -s -h w2000/
> 311M    w2000/
>
> # du -s -h --apparent-size w2000/
> 311M    w2000/
> ---------------------------------------
>
> Files copied from Windows Server 2003:
> # ls -lks w2k3
> total 328792
>    1028 -rwxrwx--x 1 root root   1024 Dec 16 18:41 001M.txt
>    2052 -rwxrwx--x 1 root root   1025 Dec 16 18:49 001M1k.txt
>    2052 -rwxrwx--x 1 root root   2048 Dec 16 18:42 002M.txt
>    3076 -rwxrwx--x 1 root root   2049 Dec 16 18:50 002M1k.txt
>    3076 -rwxrwx--x 1 root root   3072 Dec 16 18:42 003M.txt
>    4100 -rwxrwx--x 1 root root   3073 Dec 16 18:50 003M1k.txt
>    4100 -rwxrwx--x 1 root root   4096 Dec 16 18:42 004M.txt
>    5124 -rwxrwx--x 1 root root   4097 Dec 16 18:50 004M1k.txt
>    5124 -rwxrwx--x 1 root root   5120 Dec 16 18:42 005M.txt
>    6148 -rwxrwx--x 1 root root   5121 Dec 16 18:51 005M1k.txt
>    6148 -rwxrwx--x 1 root root   6144 Dec 16 18:42 006M.txt
>    7172 -rwxrwx--x 1 root root   6145 Dec 16 18:51 006M1k.txt
>    7172 -rwxrwx--x 1 root root   7168 Dec 16 18:43 007M.txt
>    8196 -rwxrwx--x 1 root root   7169 Dec 16 18:51 007M1k.txt
>    8196 -rwxrwx--x 1 root root   8192 Dec 16 18:43 008M.txt
>    9220 -rwxrwx--x 1 root root   8193 Dec 16 18:51 008M1k.txt
>    9220 -rwxrwx--x 1 root root   9216 Dec 16 18:43 009M.txt
>   10244 -rwxrwx--x 1 root root   9217 Dec 16 18:51 009M1k.txt
>   10244 -rwxrwx--x 1 root root  10240 Dec 16 18:43 010M.txt
>   11268 -rwxrwx--x 1 root root  10241 Dec 16 18:52 010M1k.txt
> 102404 -rwxrwx--x 1 root root 102400 Dec 16 18:44 100M.txt
> 103428 -rwxrwx--x 1 root root 102401 Dec 16 18:52 100M1k.txt
>
> # du -s -h w2k3/
> 322M    w2k3/
>
> # du -s -h --apparent-size w2k3/
> 311M    w2k3/
> ---------------------------------------
>
> Files copied from Windows 7 Pro:
> # ls -lks w7
> total 328792
>    1028 -rwxrwx--x 1 root root   1024 Dec 16 18:41 001M.txt
>    2052 -rwxrwx--x 1 root root   1025 Dec 16 18:49 001M1k.txt
>    2052 -rwxrwx--x 1 root root   2048 Dec 16 18:42 002M.txt
>    3076 -rwxrwx--x 1 root root   2049 Dec 16 18:50 002M1k.txt
>    3076 -rwxrwx--x 1 root root   3072 Dec 16 18:42 003M.txt
>    4100 -rwxrwx--x 1 root root   3073 Dec 16 18:50 003M1k.txt
>    4100 -rwxrwx--x 1 root root   4096 Dec 16 18:42 004M.txt
>    5124 -rwxrwx--x 1 root root   4097 Dec 16 18:50 004M1k.txt
>    5124 -rwxrwx--x 1 root root   5120 Dec 16 18:42 005M.txt
>    6148 -rwxrwx--x 1 root root   5121 Dec 16 18:51 005M1k.txt
>    6148 -rwxrwx--x 1 root root   6144 Dec 16 18:42 006M.txt
>    7172 -rwxrwx--x 1 root root   6145 Dec 16 18:51 006M1k.txt
>    7172 -rwxrwx--x 1 root root   7168 Dec 16 18:43 007M.txt
>    8196 -rwxrwx--x 1 root root   7169 Dec 16 18:51 007M1k.txt
>    8196 -rwxrwx--x 1 root root   8192 Dec 16 18:43 008M.txt
>    9220 -rwxrwx--x 1 root root   8193 Dec 16 18:51 008M1k.txt
>    9220 -rwxrwx--x 1 root root   9216 Dec 16 18:43 009M.txt
>   10244 -rwxrwx--x 1 root root   9217 Dec 16 18:51 009M1k.txt
>   10244 -rwxrwx--x 1 root root  10240 Dec 16 18:43 010M.txt
>   11268 -rwxrwx--x 1 root root  10241 Dec 16 18:52 010M1k.txt
> 102404 -rwxrwx--x 1 root root 102400 Dec 16 18:44 100M.txt
> 103428 -rwxrwx--x 1 root root 102401 Dec 16 18:52 100M1k.txt
>
> # du -s -h w7/
> 322M    w7/
>
> # du -s -h --apparent-size w7/
> 311M    w7/
> ---------------------------------------
>
> I hope to hear opinions on that topic.
>
> Also, do you know a command that can restore back the 11 MB wasted in the latter
> two cases?
>
> And finally i hope that at least smb.conf man pages will be updated warning
> about that behaviour of strict allocate.
>
> Cesare.
>
>
Hey Berni,

I think this is a Windows thing, rather than a Samba thing. Look at the 
disk space used by the last file, and two files up - It's bigger in the 
later clients (on disk that is). I recall something that Windows did 
*many moons ago* - it would write a single byte of data, 512 bytes into 
a file - or something like that.

What is the underlying file system, ext4 ? I wonder if it will be worth 
trying this on XFS, perhaps it behaves better with newer Windows clients 
? Is this an option for you ?

Cheers,

Pieter


More information about the samba mailing list