Why is my `/proc/kcore` file so large?
I was checking my disk space on my Linode, when I came across a system file named kcore
in my /proc
directory. What's weird about this file is that it's size is listed as 128 TB! My Linode's total disk size is under 100 GB, so I was wondering if this was a bug, or how this is even possible?
1 Reply
This is a pretty good question! It looks like you've discovered one of the many quirks of Linux. The neat thing about /proc/kcore
is that it doesn't actually exist, and it is impossible to delete.
The quick explanation for this is that all of the files in /proc
are virtual, meaning they do not take up any actual disk space and are there to represent information about the system. In fact, on most Linux distributions it is impossible to delete any of the files in /proc
, given that they are so vital for the system to operate. The purpose of the /proc/kcore
file specifically is that it serves as a map to every available byte in your system's memory.
Knowing that, here's where another moment of confusion can occur: If your server only has (for example) 4GB of RAM, why is /proc/kcore
described as being over 100TB? The answer to this question is that the Linux kernel will set the size of kcore
to the maximum amount of memory the system could feasibly support, which is around 128TB.
For some additional reading on the purpose of the /proc
directory, I found a few resources that you may find interesting:
- This answer to a StackOverflow question: "Why is
/proc/core
file so huge?" - suse.com - Why is
/proc/kcore
so big?
If you're looking for ways to get a better idea of the space files are actually taking up on your Linode's disk, and some methods for cleaning disk space, our Check and Clean a Linux System's Disk Space guide would help you do just that.