LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   different sizes of directories? why? (https://www.linuxquestions.org/questions/linux-newbie-8/different-sizes-of-directories-why-4175448999/)

diejengent 02-07-2013 05:57 AM

different sizes of directories? why?
 
Hello,

I just made a backup of a directory with the command "cp -Rp folder /backup/"

Then I wanted to make sure that the contents are the same by running "du -bcs" in both directories.

Turns out that the original directory was using 4096 bytes more than the backup directory; this was caused by the size of the directoy...

original directoy uses: 8192 bytes
backup directoy uses: 4096 bytes

Why is this? I mean it is an exact copy of the original directory.

Can anyone please explain why sometimes a directoy 'claims' more bytes than another directory?

Thanks in advance!

chrism01 02-07-2013 06:26 AM

You'll note that's a multiple of 4k. That's the min size of the next block. When there's a been a lot of additions and deletions, the dir file can end up with gaps.
By rebuilding it from scratch you can lose those.
https://en.wikipedia.org/wiki/Inode
http://www.cs.nyu.edu/courses/spring...ecture-24.html

diejengent 02-07-2013 07:28 AM

Thanks alot...very clear to me now.

So is it roughly to compare like a directory being a 'partition' and when there has been more action within it it becomes more 'fragmented'?


All times are GMT -5. The time now is 12:27 PM.