what are these tmpfs partitions/folders for and how to remove them?

Solution 1:

The comment and the other answer have addressed your misconceptions about tmpfs. Here, I'm going to address

Why they are here?
and
Can I remove them?
as asked.

All of these are, in systemd slang, API filesystems. They are fundamental to the operation of a systemd-based system, and the systemd program mounts them at system initialization, before it does pretty much anything else. The system-manager from nosh does much the same, excepting (currently) /sys/fs/cgroup and /tmp.

/dev/shm

On (only) Debian Linux operating systems, this is actually /run/shm. This tmpfs has the specific purpose of implementing POSIX shared memory on your operating system. Removing it will cause applications that use POSIX shared memory to fail.

/sys/fs/cgroup

This is where systemd (and others) mount the various control group control hierarchies that are available on your operating system. Removing it will stop the parts of your operating system, that depend from control groups, working.

/tmp

This is of course the place where users expect to be able to put short-stay temporary files. Removing it will make a fair number of applications that use temporary files quite unhappy.

/run

This used to be /var/run. It is where (specific kinds of) temporary files that can potentially last until the next system bootstrap are placed. You'll find this full of PID files, the systemd non-persistent journal, UNIX-domain sockets, FIFOs, and other similar things. Removing it will make the systemd journal cry; break the (mis-)management of a depressingly large number of dæmons that still, even today, use PID files; and wreck udev, the systemd "multi-seat" system, and a whole bunch of other subsystems.

On a nosh system, removing it will similarly break all of those same subsystems with their FIFOs and sockets. It will also break the service manager's control API, the service manager's associated logger dæmon, and the control/status APIs of any "early supervise" dæmons.

/dev

This is where, conventionally, all of the device files for character and block devices are stored on Unices and on Linux. A lot of programs and subsystems expect conventional names like /dev/tty, /dev/null, /dev/zero, /dev/console, /dev/fd/0, /dev/sda, and so forth to work. Removing this will break so much of your system that I doubt that it will be usable at all. This is a devtmpfs rather than a tmpfs. The difference is that the former is automatically populated and de-populated with device file entries by the kernel itself, as devices are loaded/enabled and disabled/unloaded in the kernel.

Further reading

  • system-manager. Section 8. nosh manual pages.
  • API FileSystems. Freedesktop.org.
  • File system hierarchy overview. Freedesktop.org.
  • Lennart Poettering (2011). /var/run and /var/lock on tmpfs. Fedora Project.
  • Lennart Poettering (2011-03-30). What's this /run directory doing on my system and where does it come from? Fedora Development mailing list.
  • /var/run. Filesystem Hierarchy Standard. 2.3. pathname.com.
  • /tmp. Linux Filesystem Hierarchy. The Linux Documentation Project.
  • Why put /dev/shm and /tmp under /run?. ReleaseGoals. Debian.