some of my files have an incorrect block count
Rick C. Petty
rick-freebsd2008 at kiwi-computer.com
Fri Aug 28 19:12:27 UTC 2009
On Fri, Aug 28, 2009 at 08:33:32PM +0200, Aragon Gouveia wrote:
> I'm copying data across to a larger file system and in so doing, I've
> noticed that some of the files in my old file system have an incorrect
> block count. After copying all data, df(1) reports that the new file
> system has more data on it than the old one. I've narrowed most of the
> difference to one file in particular:
Yes, these are called sparse files. Disk images are one example where
sparse files come in handy (although some argue that you should fully zero
an image initially to prevent fragmentation).
Many tools can handle sparse files efficiently. You should read their
individual man pages.
> If dd(1) reads both files in, it counts the correct size, and running
> md5(1) on both copies of the files produces the same hash, so at least
> all the data is presumably present.
If you want dd to copy sparse files correctly, you need to specify
"conv=sparse" in the target dd command. I personally prefer rsync with
> Surely fsck(8) should detect this?
> Is this inconsistency cause for concern?
No. This is just how sparse files work.
-- Rick C. Petty
More information about the freebsd-fs