From owner-freebsd-fs@FreeBSD.ORG Tue Jan 6 10:40:08 2015 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4ED35BE6 for ; Tue, 6 Jan 2015 10:40:08 +0000 (UTC) Received: from mailex.mailcore.me (mailex.mailcore.me [94.136.40.62]) by mx1.freebsd.org (Postfix) with ESMTP id 191D964D14 for ; Tue, 6 Jan 2015 10:40:07 +0000 (UTC) Received: from host81-152-205-160.range81-152.btcentralplus.com ([81.152.205.160] helo=[192.168.1.208]) by smtp04.mailcore.me with esmtpa (Exim 4.80.1) (envelope-from ) id 1Y8RYN-0007VV-R8 for freebsd-fs@freebsd.org; Tue, 06 Jan 2015 10:40:00 +0000 Message-ID: <54ABBB8D.6090801@kearsley.me> Date: Tue, 06 Jan 2015 10:40:13 +0000 From: Richard Kearsley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: freebsd-fs@freebsd.org Subject: zfs directory size accounting Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailcore-Auth: 12120934 X-Mailcore-Domain: 1490668 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jan 2015 10:40:08 -0000 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