Debian – mounts not present in fstab. where are they

debiandebugfilesystemsfstabmount

my debian system is using tmfs for a few things, notably /tmp

and it's using a rather small size for it. And it's nowhere to be found in my /etc/fstab

i guess i could just add the entry in fstab and it will take effect, but i'd really like to understand what is going on.

mount:

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=219602,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=207432k,mode=755)
/dev/disk/by-uuid/xxx on / type ext4 (rw,noatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime,size=414864k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,relatime,size=414864k)
/dev/md0 on /DATA type ext4 (rw,noatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)

fstab:

proc            /proc           proc    defaults        0       0
UUID=xxx /               ext4    noatime,errors=remount-ro 0       1
UUID=zzz none            swap    sw              0       0  
/dev/md0    /DATA   ext4    noatime,errors=remount-ro 0 0

I can understand /sys /proc /dev being kicked off by something else than fstab, and i can also understand the benefits of /tmp and /run being a fstmp… but where is that defined?

Where does those mounts come from?

Best Answer

/run is a catchall tmpfs in RAM for Debian, with the others (lock, etc.) being symlinks. By default, the size of the /run tmpfs is set to 50% of your physical memory.

/tmp is made a tmpfs only if RAMTMP=yes, or a read-only root filesystem is detected.

According to the Debian wiki, these are the steps for mounting /run, /tmp, etc., performed by initscripts and initramfs-tools:

Stage #1: Initial package install

  • /run is created on package installation
  • /var/run is bind mounted to /run
  • /var/lock is bind mounted to /run/lock
  • /dev/shm is bind mounted to /run/shm

This ensures that the /run hierarchy is present, but /var/run and /var/lock are still used for storing the files and directories accessed via /run.

Stage #2: After system reboot

  • A tmpfs is mounted on /run
  • (Optional) A tmpfs is mounted on /run/lock if RAMLOCK is configured
  • (Optional) A tmpfs is mounted on /run/shm if RAMSHM is configured
  • (Optional) A tmpfs is mounted on /tmp if RAMTMP is configured
  • A symlink /var/run → /run is created (falls back to bind mount if symlink failed)
  • A symlink /var/lock → /run/lock is created (falls back to bind mount if symlink failed)
  • A symlink /dev/shm → /run/shm is created (falls back to bind mount if symlink failed)
Related Question