[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Weird df info
On Thu, Jan 14, 1999 at 09:22:06PM +0200, Alex Shnitman wrote:
> I did a small experiment to compare gzip and bzip2, and noticed a very
> strange thing with the reporting of free diskspace. "zz" is just a
> copy of the first 89 MB of /dev/zero. :-) Now look at this:
>
[df shows small differences before and after rm zz]
>
> What the hell is going on? Is there some compression the kernel is
> doing on filesystem data that I don't know about? FWIW I'm running
> 2.2.0-pre6. It's not a multiuser system and mine was the only activity
> when I did the experiment. Any ideas? Can anyone try it on their
> system and tell me if they get the same results?
No compression. You have a hole in your disk.
More formally, you've created a "sparse file": the inode
information shows this is a 88MB file, but since you hadn't
actually written anything interesting to it yet, no disk space
has been allocated to it. Consider:
dd if=/dev/urandom of=zz seek=100 bs=512 count=1
We've just created a file with 50k of nothing, and /then/
half a k of random data. The nothing is so convincing, you
can't find it anywhere on disk (well, except for metadata).
As someone noted elsewhere, these types of files are great
fun and can lead to breaking all sorts of things that don't
know how to handle them.
--
believing is seeing
gaal@forum2.org
http://www.forum2.org/gaal/