zfs directory size accounting

Richard Kearsley richard at kearsley.me
Tue Jan 6 10:40:08 UTC 2015


Hello
In my system I am using a subdirectory structure to store millions of 
files, like

0-f/0-f/0-f/0-f/0-f/file.ext

I have recently discovered that the size of the directory itself (not 
including the files within it) is variable for some reason - I has the 
understanding that it was a fixed size

for example:

0/0/0/0 # ls -als
total 564
  9 drwxr-xr-x  16 root  wheel  16 Jan  3 13:57 .
  9 drwxr-xr-x  18 root  wheel  18 Feb 18  2014 ..
25 drwxr-xr-x   2 root  wheel   6 Jan  5 17:52 2
25 drwxr-xr-x   2 root  wheel   8 Jan  5 17:52 3
25 drwxr-xr-x   2 root  wheel   4 Jan  5 17:31 4
25 drwxr-xr-x   2 root  wheel   2 Jan  3 04:36 5
25 drwxr-xr-x   2 root  wheel   6 Dec 29 21:47 6
25 drwxr-xr-x   2 root  wheel   6 Jan  3 18:39 7
25 drwxr-xr-x   2 root  wheel  17 Jan  4 15:43 8
93 drwxr-xr-x   2 root  wheel   4 Jan  4 03:57 9
25 drwxr-xr-x   2 root  wheel   8 Jan  3 22:01 a
93 drwxr-xr-x   2 root  wheel   5 Jan  3 20:18 b
25 drwxr-xr-x   2 root  wheel   8 Jan  5 18:04 c
93 drwxr-xr-x   2 root  wheel   9 Jan  5 16:25 d
25 drwxr-xr-x   2 root  wheel   6 Jan  4 08:02 e
25 drwxr-xr-x   2 root  wheel  10 Jan  4 18:56 f

I believe the block count (first number) in particular makes a big 
difference on filesystem space usage which is potentially a problem for me

0/0/0/0 # stat b 1598987375 6362113 drwxr-xr-x 2 root wheel 4294967295 5 
"Oct 5 01:07:43 2014" "Jan 3 20:18:04 2015" "Jan 3 20:18:04 2015" "Oct 5 
01:07:43 2014" 16384 185 0 b

directory 'b' is using 185 512-byte blocks - 94720 bytes!... why?

Many thanks
Richard



More information about the freebsd-fs mailing list