Mysterious block count (reproducible)
Bernd Walter
ticso at cicely12.cicely.de
Sat Feb 3 13:36:48 UTC 2007
On Fri, Feb 02, 2007 at 09:05:48PM +0100, Oliver Fromme wrote:
> 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?
Don't forget the block needed for the indirect table.
fsdb only shows data blocks it seems.
--
B.Walter http://www.bwct.de http://www.fizon.de
bernd at bwct.de info at bwct.de support at fizon.de
More information about the freebsd-fs
mailing list