1

I made a recursive copy of directory but according to du the two directories have different sizes.

$ cp -r site2 site
$ du site
838048  site/ca.oslin.org
276108  site/hts-cache
1114196 site
$ du site2
838360  site2/ca.oslin.org
276116  site2/hts-cache
1114516 site2
$ du -b site
582078187   site/ca.oslin.org
282724514   site/hts-cache
864830213   site
$ du -b site2
582393579   site2/ca.oslin.org
282724514   site2/hts-cache
865145605   site2
$ ls -a site2/ca.oslin.org/|wc -l
103060
$ ls -a site/ca.oslin.org/|wc -l
103060
$ diff -r site site2
$
2
  • Try doing ls -s on those directories? Mar 9, 2015 at 13:46
  • @Miline ls -s reports different sizes as well
    – Ernest A
    Mar 9, 2015 at 13:55

1 Answer 1

5

du reports the disk usage, i.e. the size the files and all surrounding metadata is taking on the disk.

The fact you have a very minor discrepancy (0.10%) between the source and destination directories is likely due to the fact the original directory had files that were removed but that still use some ghost space in the directory entries table themselves.

You shouldn't worry about it. In fact, you might have found much larger discrepancies if going from one file system type to another, and even more if some original files were sparse files, or one or the other file systems was implementing compression.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.