The /proc
directory itself exists as an empty directory on the hard drive. It's contents, however, are added by the kernel without touching the disk. If you try to access /proc
before it is mounted (say, booting your system with nothing but a shell with init=/bin/sh
), it will be empty.
You can replicate /proc
on any directory with mount -t proc proc /path/to/directory
.
Just like ext4
, fat32
, etc., proc
is a filesystems. (It is referred to as a pseudo filesystem because it cannot actually be used for storing files. If you try to do so, even as root, it will not work.) There are 'real' filesystems like proc
that don't write to the disk, say ramfs
/tmpfs
. These filesystems don't actually write their files the disk, rather keeping them in the system ram. (If it isn't already there, I recommend adding the line tmpfs /tmp tmpfs rw 0 0
to your /etc/fstab
so that temporary files written to /tmp
don't actually get written to your disk.)
There are a few other pseudo filesystems, like sysfs
on /sys
and devtmpfs
on /dev
. (/dev
is slightly different. It isn't maintained by the kernel, and devtmpfs
isn't always mounted over /dev
, sometimes block files are written directory to the disk.)