Incorrect file size?
Krassimir Slavchev
krassi at bulinfo.net
Mon Jun 23 06:42:10 UTC 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Oliver Fromme wrote:
> Ivan Voras wrote:
> > Rink Springer wrote:
> > > The 'vscan' user leads me assume this is SpamAssassin - I've seen this
> > > behaviour at work, where our scripts were trying to backup a 1TB file
> > > (which actually was ~vscan/.spamassassin/auto-whitelist). The result was
> > > that the backup script died due to lack of disk space on the backup
> > > server (as we don't use compression).
> > >
> > > When I was investigating why the file could be so large it, it turned
> > > out the file was only a few hunderd 'real' MB's, so that is why I assume
> > > this person is having the same issue as we do. The file is a Berkeley DB
> > > file, by the way, so there's nothing textfile about it ;-)
> >
> > I learn something every day :)
> > Didn't know BDB was smart enough to create sparse files.
>
> BTW, you can use "ls -ls" to display the number of physical
> blocks allocated to the file, so you can easily see whether
> a file is sparse or not:
>
> $ dd if=/dev/zero of=foo1 bs=1m count=1
> $ truncate -s 1m foo2
> $ ls -ls foo1 foo2
> 1040 -rw------- 1 olli olli 1048576 Jun 20 22:43 foo1
> 32 -rw------- 1 olli olli 1048576 Jun 20 22:43 foo2
# ls -lsk
total 1247288
664064 -rw------- 1 vscan vscan 4398199488512 Jun 23 09:39
auto-whitelist
88 -rw------- 1 vscan vscan 89976 Jun 23 09:39 bayes_journal
566704 -rw------- 1 vscan vscan 1099639861248 Jun 23 09:39 bayes_seen
16432 -rw------- 1 vscan vscan 21454848 Jun 23 09:39 bayes_toks
>
> As you can see, the file size is the same, but the block
> counts are different (I have BLOCKSIZE=K in my environment,
> so the blocks are displayed in 1KB units).
>
> I've written a small script that can be used to detect
> sparse files (it even displays the "sparseness" percentage):
>
> http://www.secnetix.de/olli/scripts/sparsecheck
>
> Best regards
> Oliver
>
> PS: Of course it is still possible that a file system is
> corrupt and needs fsck, no matter whether those files are
> sparse or not.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)
iD8DBQFIX0W+xJBWvpalMpkRAqrdAJ47eLQ+WMp6zBrme5gNyCSvzBtdUwCffYwT
+37ul1gPqmk7rVKXRrha7fU=
=uSGe
-----END PGP SIGNATURE-----
More information about the freebsd-stable
mailing list