2

I'm copying a directory from one mount point to another, yet I see a size increase between the two and I'm wondering why that is.

My first mount point is named /home/directory/mount1, and inside it I have a "bin" directory, where, when I do du -hs bin, I see it has a size of 7.9 M. I copy this over to /home/directory/mount2 using cp -ap bin /home/directory/mount2 from inside /home/directory/mount1. Then, however, when I do du -hs bin inside /home/directory/mount2, I get a size of 8.3M!

I'm logged in as root and from what I can tell, the exact same files in the mount1 bin directory were copied over to mount2. What is with the size discrepancy? It was also present when I did cp -r bin /home/directory/mount2.

Edit: Upon further examination, every file in the contents of bin in mount2 is 4K larger than its equivalent in mount1/bin.

  • The answers for http://unix.stackexchange.com/questions/106275/du-gives-two-different-results-for-the-same-file give some reasons why this can happen. – JigglyNaga May 25 '16 at 12:27

1 Answers1

1

Thank you for the link in your comment, JigglyNaga. From there I found that my command du -hs bin shows the disk usage of the contents of the directory. There are actually two separate images mounted on each of the two mount points (mount1 is partitioned, mount2 is just a pure ext3 filesystem).

According to the link in the comment, if I want to check the size of a file or directory on its own without relating to disk space, I can use ls -l or du -b. Doing this, the size of bin and all its contents are the same for both mount points. I will use these commands from now on. Thanks!