Why doesn't /proc take up disk space?

1

Why doesn't /proc take up disk space?

When I put sudo du -sh /proc it return 0.

I think that is something related to its purpose, but I'm not sure.

Why?

Joe

Posted 2017-04-17T13:06:21.220

Reputation: 1

Answers

1

Why doesn't /proc take up disk space?

Because it is a 'virtual filesystem', and doesn't store data in the same way as a filesystem for a hard drive:

/proc is very special in that it is also a virtual filesystem. It's sometimes referred to as a process information pseudo-file system. It doesn't contain 'real' files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc). For this reason it can be regarded as a control and information centre for the kernel. In fact, quite a lot of system utilities are simply calls to files in this directory. For example, 'lsmod' is the same as 'cat /proc/modules' while 'lspci' is a synonym for 'cat /proc/pci'. By altering files located in this directory you can even read/change kernel parameters (sysctl) while the system is running.

From the Linux Documentation Project; which has a fuller explanation of the proc filesystem and what various parts refer to (a bit beyond the scope of this question).

Red Hat also have an explanation page about the parts of proc which is a bit shorter and ptoentally more manageable. There is also some general information on Wikipedia about procfs.

Since it only contains (and controls) ephemeral information, it doesn't take up any space.

bertieb

Posted 2017-04-17T13:06:21.220

Reputation: 6 181