]> git.ipfire.org Git - thirdparty/systemd.git/blame - docs/API_FILE_SYSTEMS.md
Merge pull request #32320 from bluca/softreboot_serialize
[thirdparty/systemd.git] / docs / API_FILE_SYSTEMS.md
CommitLineData
6b2a2776 1---
2title: API File Systems
3category: Manuals and Documentation for Users and Administrators
4layout: default
5SPDX-License-Identifier: LGPL-2.1-or-later
6---
7
8# API File Systems
9
10_So you are seeing all kinds of weird file systems in the output of mount(8) that are not listed in `/etc/fstab`, and you wonder what those are, how you can get rid of them, or at least change their mount options._
11
e7f7da45 12The Linux kernel provides a number of different ways for userspace to communicate with it.
13For many facilities there are system calls, others are hidden behind Netlink interfaces, and even others are exposed via virtual file systems such as `/proc` or `/sys`.
14These file systems are programming interfaces, they are not actually backed by real, persistent storage.
15They simply use the file system interface of the kernel as interface to various unrelated mechanisms.
16Similarly, there are file systems that userspace uses for its own API purposes, to store shared memory segments, shared temporary files or sockets.
17In this article we want to discuss all these kind of _API file systems_.
18More specifically, here's a list of these file systems typical Linux systems currently have:
6b2a2776 19
20* `/sys` for exposing kernel devices, drivers and other kernel information to userspace
21* `/proc` for exposing kernel settings, processes and other kernel information to userspace
22* `/dev` for exposing kernel device nodes to userspace
23* `/run` as location for userspace sockets and files
24* `/tmp` as location for volatile, temporary userspace file system objects (X)
25* `/sys/fs/cgroup` (and file systems below that) for exposing the kernel control group hierarchy
26* `/sys/kernel/security`, `/sys/kernel/debug` (X), `/sys/kernel/config` (X) for exposing special purpose kernel objects to userspace
27* `/sys/fs/selinux` for exposing SELinux security data to userspace
28* `/dev/shm` as location for userspace shared memory objects
29* `/dev/pts` for exposing kernel pseudo TTY device nodes to userspace
30* `/proc/sys/fs/binfmt_misc` for registering additional binary formats in the kernel (X)
31* `/dev/mqueue` for exposing mqueue IPC objects to userspace (X)
32* `/dev/hugepages` as a userspace API for allocating "huge" memory pages (X)
33* `/sys/fs/fuse/connections` for exposing kernel FUSE connections to userspace (X)
34* `/sys/firmware/efi/efivars` for exposing firmware variables to userspace
35
e7f7da45 36All these _API file systems_ are mounted during very early boot-up of systemd and are generally not listed in `/etc/fstab`.
37Depending on the used kernel configuration some of these API file systems might not be available and others might exist instead.
38As these interfaces are important for kernel-to-userspace and userspace-to-userspace communication they are mounted automatically and without configuration or interference by the user.
39Disabling or changing their parameters might hence result in applications breaking as they can no longer access the interfaces they need.
6b2a2776 40
41Even though the default settings of these file systems should normally be suitable for most setups, in some cases it might make sense to change the mount options, or possibly even disable some of these file systems.
42
e7f7da45 43Even though normally none of these API file systems are listed in `/etc/fstab` they may be added there.
44If so, any options specified therein will be applied to that specific API file system.
45Hence: to alter the mount options or other parameters of these file systems, simply add them to `/etc/fstab` with the appropriate settings and you are done.
46Using this technique it is possible to change the source, type of a file system in addition to simply changing mount options.
47That is useful to turn `/tmp` to a true file system backed by a physical disk.
6b2a2776 48
e7f7da45 49It is possible to disable the automatic mounting of some (but not all) of these file systems, if that is required.
50These are marked with (X) in the list above.
51You may disable them simply by masking them:
6b2a2776 52
53```sh
54systemctl mask dev-hugepages.mount
55```
56
e7f7da45 57This has the effect that the huge memory page API FS is not mounted by default, starting with the next boot.
58See [Three Levels of Off](http://0pointer.de/blog/projects/three-levels-of-off.html) for more information on masking.
6b2a2776 59
e7f7da45 60The systemd service [systemd-remount-fs.service](http://www.freedesktop.org/software/systemd/man/systemd-remount-fs.service.html)
61is responsible for applying mount parameters from `/etc/fstab` to the actual mounts.
6b2a2776 62
63## Why are you telling me all this? I just want to get rid of the tmpfs backed /tmp!
64
65You have three options:
66
e7f7da45 671. Disable any mounting on `/tmp` so that it resides on the same physical file system as the root directory.
68 For that, execute `systemctl mask tmp.mount`
692. Mount a different, physical file system to `/tmp`.
70 For that, simply create an entry for it in `/etc/fstab` as you would do for any other file system.
713. Keep `/tmp` but increase/decrease the size of it.
72 For that, also just create an entry for it in `/etc/fstab` as you would do for any other `tmpfs` file system, and use the right `size=` option.