From owner-freebsd-fs@FreeBSD.ORG Fri Feb 2 20:05:58 2007 Return-Path: X-Original-To: freebsd-fs@FreeBSD.ORG Delivered-To: freebsd-fs@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3CE7516A401 for ; Fri, 2 Feb 2007 20:05:58 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.freebsd.org (Postfix) with ESMTP id A7C9E13C4A3 for ; Fri, 2 Feb 2007 20:05:57 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (uzyroz@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id l12K5mHR017339 for ; Fri, 2 Feb 2007 21:05:55 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id l12K5mli017338; Fri, 2 Feb 2007 21:05:48 +0100 (CET) (envelope-from olli) Date: Fri, 2 Feb 2007 21:05:48 +0100 (CET) Message-Id: <200702022005.l12K5mli017338@lurza.secnetix.de> From: Oliver Fromme To: freebsd-fs@FreeBSD.ORG User-Agent: tin/1.8.2-20060425 ("Shillay") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 02 Feb 2007 21:05:55 +0100 (CET) Cc: Subject: Mysterious block count (reproducible) X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2007 20:05:58 -0000 Hi The following is on a standard UFS2 file system under FreeBSD 6.2, block size 16 KB, fragsize 2 KB. The filesystems are perfectly ok and fsck-clean. There haven't been any physical disk errors either. I've got a file on my home partition that's 214848 bytes. According to math it should occupy 14 blocks. However: $ BLOCKSIZE=16K ls -s foo 15 foo I copied the file to /tmp (which is an mdfs, also UFS2 with default parameters). Same result. I created a fresh file from /dev/zero of 214848 bytes. The same. Where does the 15th block come from? Those additional 16 KB must be used for _something_ somewhere ... fsdb(8) isn't helpful either: # fsdb -r /dev/md0 fsdb (inum: 2)> ls [...] slot 7 ino 5 reclen 20: regular, `foo' fsdb (inum: 2)> inode 5 current inode: regular file I=5 MODE=100600 SIZE=214848 BTIME=Feb 2 20:46:02 2007 [0 nsec] MTIME=Feb 2 20:46:02 2007 [0 nsec] CTIME=Feb 2 20:46:02 2007 [0 nsec] ATIME=Feb 2 20:46:58 2007 [0 nsec] OWNER=root GRP=wheel LINKCNT=1 FLAGS=0 BLKCNT=1e0 GEN=ffffffffe2ca5220 0x1e0 is 224 (== 14 * 16). So fsdb(8) doesn't see the 15th block either. To confirm: fsdb (inum: 5)> blocks Blocks for inode 5: Direct blocks: 2136, 2144, 2152, 2160, 2168, 2176, 2184, 2192, 2248, 2256, 2264, 2272 Indirect blocks: 2280, 2288, fsdb (inum: 5)> It lists 12 direct blocks and 2 indirect blocks, that's still 14 blocks, not 15. Where did the 15th block go?!? Or is there a bug in the calculation of ls -s output? Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, USt-Id: DE204219783 Any opinions expressed in this message are personal to the author and may not necessarily reflect the opinions of secnetix GmbH & Co KG in any way. FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "Being really good at C++ is like being really good at using rocks to sharpen sticks." -- Thant Tessman