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

0

1

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?

JIV

Posted 2014-10-05T16:23:15.473

Reputation: 117

Answers

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.

jlliagre

Posted 2014-10-05T16:23:15.473

Reputation: 12 469

ah okay thx.... – JIV – 2014-10-06T10:56:18.120