I posted the following problem:
----- Begin Included Message -----
Here I am again with another puzzling thing:
I find an 8 Mbyte core in the /-directory.
When I do a df, it shows, that there's all
in all 15 Mbytes in the root-area, 4 of which
are still available. So I remove the core,
and do a 'df' again. Now the amount of free
space has risen with app. 400 Kbytes, and that
could be due to other activity on the partition.
As far as I can see, there is no running
process that could hold the core-file open,
so it should be removed really (at least I
think so, I used the program lsof to check).
When counting the files that are actually
on disk using du, the core-file does not
seem to count.
Unfortunately I removed the core file before
giving myselg proper time to look into it,
at least to see what program generated it.
Could anyone give me a hint on this one ?
----- End Included Message -----
Thanks to a lot of people, too many to list.
The solution was quite simple. The core in question
is a socalled sparse file (or a 'holy' file as one
calls it). The file's inode contains an indication
of the 8 Mbyte lenght, but the tree-structure that
administers the file is almost empty; few blocks
have actually been allocated on disk.
A very educative example was given to me by
fd = creat("testfile", 0644);
lseek(fd, 1000000, 0);
write(fd, "a", 1);
(or dd if=/dev/zero of=testfile seek=1000000 count=1)
When running the program and listing it with 'ls -ls',
it give the following:
16 -rw-r--r-- 1 morten 1000001 Dec 7 10:16 testfile
...indicating that the file takes up 16 Kbytes, and that
the size of the file is 1 Mbyte (!). So, in effect only
16 Kbytes have been allocated on disk, but the inode
says 1 Mbyte.
firstname.lastname@example.org points out that it is normal for a core-
file to contain a large hole that corresponds to the gap
between the proces's memory space between the data and the
So, no mystery.
Morten Krabbe Barfoed
Danish Space Research Institute phone: +45 42 88 22 77 (switch-board)
Gl. Lundtoftevej 7 phone: +45 45 87 40 77 - 161 (direct)
DK 2800 Lyngby FAX: +45 45 93 02 83
Denmark TELEX: 37 198
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:16 CDT