Question about file system block size

I am using XFS file system for my storage needs. Most of my catalogs have 4096KB in file size, but some have less than that and some have a lot more.
Some catalogs that I have a few thousand files the catalog file size is aprox 118000KB.

How come some of my catalogs have different file size than the default block size?

Also some files have less size than 4096KB (this I have seen for both ext4 and XFS).

Every new catalog that I create gets 6KB of file system size. If I add an empty file in that catalog the file size increases to 17KB while the empty file gets 0KB.

When you write catalog do you mean directory? I don’t think the directory size (in bytes) has anything to do with the filesystem block size. It’s whatever the filesystem wants to make it. If there are more entries then it will be larger. I have XFS and directories start off at 4kB and seem to go up in increments of 4kB.

Used wrong word. catalog–>Directory

On my disks with XFS directories starts with file size of 6 bytes only. Some directories have 4096 bytes (I guess it is bytes).

drwxr-xr-x 2 djviking users **6 **01.12.2012 22:46:27 Test1
drwxr-xr-x 2 djviking users 6 01.12.2012 22:46:41 Test2

drwx------ 3 djviking users 4096 11.22.2011 17:22:01 Temp
drwxr-xr-x 2 djviking users 6 01.12.2012 22:48:52 Test

Also: The content/(totalt file size) in two other directories are very different, but both directory have 4096 bytes in file size.

I am just trying to make sense of it. I have read that XFS could use a variable block size.

Yup, same here, empty directories start off at 6 bytes and become 4kB next. Depending on what’s stored in each entry, 4kB could handle quite a few entries.

Directories, like files, can be any length. Of course, on the filesystem, it’s rounded up to the next full block, whatever size that is, and the last bit is “wasted”.