Date: Mon, 5 Feb 2007 16:28:41 +0100 (CET) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-fs@FreeBSD.ORG, ticso@cicely.de Subject: Re: Mysterious block count (reproducible) Message-ID: <200702051528.l15FSfsj085766@lurza.secnetix.de> In-Reply-To: <20070203130226.GO70860@cicely12.cicely.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Bernd Walter wrote: > Oliver Fromme wrote: > > [...] > > $ BLOCKSIZE=16K ls -s foo > > 15 foo > > # fsdb -r /dev/md0 > > [...] > > 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? (Meanwhile I found out that ls(1) doesn't really calculate anything; it simply displays the st_blocks value from the stat structure rounded to $BLOCKSIZE, of course.) > Don't forget the block needed for the indirect table. > fsdb only shows data blocks it seems. Oh, OK ... I really assumed that fsdb would display them as soon as they come into play. :-( What I'm trying to do is to write a small script that calculates the allocation vs. virtual size ratio of sparse files. For that purpose I have to find out how many blocks a file would require if it wasn't sparse. Is there are an easy way to get that information? I have currently hardcoded some information in the script, but it's an ugly hack: http://www.secnetix.de/~olli/scripts/sparsecheck 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 "IRIX is about as stable as a one-legged drunk with hypothermia in a four-hundred mile per hour wind, balancing on a banana peel on a greased cookie sheet -- when someone throws him an elephant with bad breath and a worse temper." -- Ralf Hildebrandt
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702051528.l15FSfsj085766>