Difference in file size between "ls -l" and "du -a"

mail:/var/lib/named/proc # ls -l |grep kcore
-r--------   1 root       root       140737486266368 Jun  3 19:47 kcore
mail:/var/lib/named/proc # du -a |grep kcore
0       ./kcore

System is SuSE 11.2 SP1.
The system appears to run correctly, and the output of df -v shows the correct disk usage (about 30gb).

kcore (kernel core) is a virtual file (on vfs) and is like the mirror of the memory space that kernel can allocate the amount of this memory size (think kernel memory) and it doesnt use the physical disk space and memory.shortly it equals to RAM size.We can may understand from that the kernel read/write and the other mem operations to use the kdebug utilites

# ls -ltr /proc/kcore|awk '{print $5/1024/1024/1024"GB"}'

and this must give about same values..

# awk '/MemTotal/{print $2/1024/1024"GB"}' /proc/meminfo

shortly it equals to RAM size,additional some platforms also it corresponds to virtual memory space for kernel..
then could be try (ia64 , im not sure,)

# awk '/VmallocTotal/{print $2/1024/1024"GB"}' /proc/meminfo

in this kcore representation total allocated virtual address space

for exa (dont try production machine or any !!)
i test it VM machine
its a little dump

# sed -n 'p' /proc/kcore|strings
CORE
CORE
vmlinux
ro root=/dev/VolGroup01/LogVol00 rhgb quiet ramdisk_size=11000000
CORE

regards
ygemici

1 Like