LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   4096 (https://www.linuxquestions.org/questions/linux-newbie-8/4096-4175482753/)

jknath 10-30-2013 06:42 AM

4096
 
Hi, Im posting this question post verifying all similar question related to this.

"Why is the size of a directory always 4096 bytes in unix?"

Can u tell me the layman example? Im a beginner. So plz explain me easily understandable.

Thanks

druuna 10-30-2013 07:02 AM

Whenever a directory is created it takes 1 block for storing some system related info (meta-data about files, including the file names contained in that directory).

This doesn't always amount to 4k (4096), it depends on the block-size, which is 4096 on most modern Linux machines.

If 1 block isn't enough to store the data, it adds another block (and another and ...). The directory size is always a multiple of the block-size.

You can get the block-size that is used with the dumpe2fs command:
Code:

dumpe2fs /device | grep "^Block size:"


All times are GMT -5. The time now is 08:28 AM.