36

Is there any difference between /run directory and var/run directory. It seems the latter is a link to the former. If the contents are one and the same what is the need for two directories?

26

From the Wikipedia page on the Filesystem Hierarchy Standard:

Modern Linux distributions include a /run directory as a temporary filesystem (tmpfs) which stores volatile runtime data, following the FHS version 3.0. According to the FHS version 2.3, this data should be stored in /var/run but this was a problem in some cases because this directory isn't always available at early boot. As a result, these programs have had to resort to trickery, such as using /dev/.udev, /dev/.mdadm, /dev/.systemd or /dev/.mount directories, even though the device directory isn't intended for such data. Among other advantages, this makes the system easier to use normally with the root filesystem mounted read-only.

So if you have already made a temporary filesystem for /run, linking /var/run to it would be the next logical step (as opposed to keeping the files on disk or creating a separate tmpfs).

  • 3
    To make it clear, /run is new /var/run. So, /var/run is generally symlinked to /run. – x-yuri Mar 31 '19 at 1:30
9

Some utilities traditionally used /var/run, other /run to store their process related material. When these were real on disc directories it did not matter too much that these were separate directories.

Nowadays /run/ is often implemented as a tmpfs ( mount | fgrep run ) and data in those directories won't survive a reboot (which is a good thing). It makes a little more sense to map these together using a symbolic link, and save a mount, especially as the permissions and settings for these directories would be the same anyway (in contrast to some other "directories" that are on tmpfs )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.