DU reports different folder size in unix and cygwin (windows)

I was copying some files from windows machine to unix one (debian) and after checking file count (both matched) i tested folder size with du and i got different results:

windows:

@/cygdrive/f/Cubie-Drive/download/files
$ du -s .
487040665       .

and unix:

root@Cubian:/opt/ftp/ftpuser-home/upload# du -s .
487042376       .

du versions, windows:

$ du --version
du (GNU coreutils) 8.15
Packaged by Cygwin (8.15-1)
Copyright (C) 2012 Free Software Foundation, Inc.

and unix:

du (GNU coreutils) 8.13
Copyright (C) 2011 Free Software Foundation, Inc.

any idea why is there a slight difference?


Solution 1:

du is reporting the disk usage of the files, not the cumulated size of the files which looks like to be what you are expecting.

Different file systems (like NTFS and ext4 for example) use different methods to store directories and file metadata like file permissions. They might also use a different allocation unit size (cluster/record size) which lead to a diversity in per file overhead.

There is then no surprise for the same set of files to use differring disk size when stored on different file systems.