Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Jan 2015 10:40:13 +0000
From:      Richard Kearsley <richard@kearsley.me>
To:        freebsd-fs@freebsd.org
Subject:   zfs directory size accounting
Message-ID:  <54ABBB8D.6090801@kearsley.me>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54ABBB8D.6090801>