FG
💻 Software

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

Fresh5 days ago
Mar 15, 202636061 views
Confidence Score0%
0%

Problem

I am sure a directory file has much less information than 4096 bytes. I know the sector size is 4096 bytes. But normal files smaller than that do exist. Why does Unix reserve 4096 bytes for each folder?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Why is the size of a directory always 4096 bytes in unix?

Low Risk

It's the initial size necessary to store the meta-data about files contained in that directory (including names). The initial allocation equals the size of one sector, but can grow above that if necessary. Once allocated, space is not freed if files…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment