Thread: Small file taking up lots of disk space

Small file taking up lots of disk space

From
"Jason Williams"
Date:
Hello,

I have a server running RH 7.2 with kernel 2.4.7-10smp.
We are running postgresql 7.2.1 and it has generated a log file.

"ls -l" reports this file to be of 9531465 (9.5MB) bytes in size.
"du" reports this file to be using 17833520 1K blocks (18GB) of disk
space.

I realize there will be some discrepancy between du and ls, but this
is several orders of magnitude.  Just to be sure, I ran "wc -c" on the
file and it reports 9531465 characters in the file.  I then copied the
file to the /tmp directory and then du reports only 9347 1K blocks in
use.  What??!!?

Postgresql is still running while I'm looking at this file, but I
don't think that would cause this.

Anybody have a clue what is going on here?

Thanks,

Jason


Re: Small file taking up lots of disk space

From
tycho@fruru.com
Date:
On Tue, 25 Mar 2003, Jason Williams wrote:

> Hello,
>
> I have a server running RH 7.2 with kernel 2.4.7-10smp.
> We are running postgresql 7.2.1 and it has generated a log file.
>
> "ls -l" reports this file to be of 9531465 (9.5MB) bytes in size.
> "du" reports this file to be using 17833520 1K blocks (18GB) of disk
> space.
[snip]
> Anybody have a clue what is going on here?

Try to upgrade your kernel to something more recent (like 2.4.20).   I've
encountered the same behaviour with old kernels on ext3 filesystems and
postgres.  It's nothing that a nice e2fsck cannot correct though.

Cheers,
Tycho


Re: Small file taking up lots of disk space

From
Andrew Sullivan
Date:
On Tue, Mar 25, 2003 at 05:11:21PM -0500, Jason Williams wrote:
> Postgresql is still running while I'm looking at this file, but I
> don't think that would cause this.

Depends on the platform, but yes, it would.  The file may still be
open.  The raw size of the file is one thing, but the amount of disk
it uses is another.  For further discussion, see

<http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fwpaper/26928>

A

--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110