/proc kcore file is huge
In answer to your original question:
"Is it safe to delete the
/proc/kcore
file? Or is there a solution on getting it to an normal size."
No, it's not safe. Well, I wouldn't like to bet what would happen if you deleted it anyway!
The /proc
directory is the mount point for procfs (run mount
and see the output like below: )
proc on /proc type proc (rw)
procfs is a bit of dark magic; no files in it are real. It looks like a filesystem, acts like a filesystem, and is a filesystem. But not one that is stored on disk (or elsewhere).
/proc/kcore
specifically is a file which maps directly to every available byte in your virtual memory ... I'm not absolutely clear on the details; the 128TB comes from Linux allocating 47ish bits of the 64bits available for virtual memory.
(There's discussion on the 128TB limit here: https://unix.stackexchange.com/questions/116640/what-is-maximum-ram-supportable-by-linux )
Anyway, putting aside Linux's hard-coded virtual memory limits - what we come to understand in the context of your question is this: /proc/kcore
is a system file, provided by the virtual procfs filesystem, and is not a real file.
Don't delete it ;-)
Update: 2016-06-03
My answer here keeps periodically being up-voted - so I assume people are still looking for an explanation of what /proc/kcore
is.
There's a helpful Wikipedia article titled Everything is a file which gives a little background. If you're really curious - take a look into the Plan9 OS.
Hopefully my original answer sufficiently explains kcore
itself. I'm speculating that people reading this answer may be curious about other files in /proc
too - so here are some other "interesting" examples.
-
/proc/sys/*
is a mechanism for the user (you) to read/write details from the heart of Linux (the kernel and associated drivers etc). A cute example of a r/w item is "IP forwarding":Read:
cat /proc/sys/net/ipv4/ip_forward
(0
is off,1
is on)Write:
echo 1 > /proc/sys/net/ipv4/ip_forward
As with
kcore
, this isn't a real file. But it acts like one. So when you write to it, you're actually changing software settings as opposed to bytes on a disk. -
/proc/meminfo
and/proc/cpuinfo
are read-only. You cancat
orless
them, orfopen()
from your own application. They show you details about your hardware (memory and CPU). -
/proc/[0-9]+
are actually process IDs running on your machine! These are (IMHO) by far the coolest feature of/proc
. Inside them you will find more fake files likecmdline
which tell you what command was used to start the process.
Finally there's some other examples of "interesting filesystems", like /proc
. There are purely in-memory and "user-space" to name just two. Again these (generally speaking) do not consume any real disk space, although tools like df
and ls
may report real file sizes.
It's completely safe to run the command sudo rm /proc/kcore
. It will just say rm: cannot remove '/proc/kcore': Operation not permitted
.
All the files in /proc
do not actually exist on your hard drive, so they can't be removed. Those files represent information about the system. For example, when you do ls /proc
, you're asking the kernel for a list of the processes on the system. If you run ls -l /proc/22/exe
, you're asking the kernel for the file path of the executable of process number 22. And so on.
please check your log file space. I removed all error log and access log files and my website is running.
Using this command to check which folder is taking more space.
cd /
sudo du -sh * 2>/dev/null | sort -h
Looks like you need to clean up the disk of files that are deleted but are reserved. You can use the 'tune2fs' command with something like:
tune2fs -m 1 /dev/<drive>
This should free up the reserved block space and give you access to the privileged processes reserved disk space. Note that 1 is the percentage that will be allocated to the privileged processes afterwards, do this only if you have enough disk space for critical processes such as syslog, or ssh.
NOTE: You will never gain disk space by removing files from '/proc'. That is a virtual filesystem that has nothing whatsoever to do with space on your HDD.