Linux Format

A QUICK REFERENCE TO… VIRTUAL FILESYSTEM­S

-

Linux contains a number of virtual filesystem­s, ones that do not contain actual files but present informatio­n as though it were a file. The one most commonly used is /dev, which contains node ‘files’ to access most devices on the system – most notably, but in no way restricted to, storage devices. Two other virtual filesystem­s are mounted at /proc and

/sys. These expose various aspects of the inner workings of the system. You can read all of them, at least if you are root – for example, /proc/mounts contains details of all mounted filesystem­s, /proc/cmdline shows the options passed to the kernel when the system was booted, while /proc/cpuinfo lists your processor cores and their capabiliti­es. As /sys works similarly, why have both? Well, /proc has been around for ever, while /sys is a more recent addition, containing more informatio­n. It seems the intention to migrate everything to /sys got lost somewhere along the way so we have both legacy and modern systems alongside one another.

Everything in these filesystem­s is readable and many of the files are also writable, such as the example in the question about backlights. They provide a low-level way to access attributes of the system, suitable for use in scripts and the like.

Because the three virtual filesystem­s mentioned here are all mounted directly under /, it is important to exclude them when making backups. In particular, /proc/kcore can get huge. It contains kernel memory informatio­n and grows continuall­y – it is currently showing as 128TB on this machine!

Newspapers in English

Newspapers from Australia