Search the docs

Why a Directory Always Shows 4096 Bytes

Applies to: Hammerspace 5.2 and later.

Running ls -l against a Hammerspace share always reports 4096 for every directory. Nothing is wrong.

What ls Is Actually Reporting

The size ls shows for a directory is the size of the directory entry itself, not the total size of the files inside it. That surprises people, and different NAS file systems compound the confusion by storing directories differently — which shows up as variation in what ls prints.

On native Linux file systems the directory entry is typically one 4096-byte block, though it varies, and it can grow as the number of files and subdirectories grows. Even then it does not correspond to the storage those files use. NetApp, for example, stores directories as structured data in blocks in ONTAP.

Why Hammerspace Always Reports 4096

Hammerspace stores a directory as a single RocksDB record. There is no per-directory structure whose size varies, so Linux reports 4096 for every directory on a share, always.

Use du for Actual Usage

ls -l

The size of the directory entry. On Hammerspace, always 4096.

du -sh

The total size of the directory’s contents, which is the useful measure of disk usage.

For the full set of ls options, see the Linux ls manual page.