0
From my knowledge of the `/tmp` directory, it is cleared on reboot.

I'm unsure what happens to the living host whenever the /tmp folder is flooded (put to the max storage capacity) - does Linux have some sort of fail safe to this, or will it, until reboot, leave the files there?

1
  • Your assumption that /tmp always gets cleared on reboot is wrong - POSIX recommends "that files and directories located in /tmp be deleted whenever the system is booted" (source), but it's not required, some distros don't.
    – Panki
    Mar 8 at 15:21

1 Answer 1

3

/tmp directory, it is cleared on reboot

If it's tmpfs (valid for some newer distros), then yes. Otherwise it's not generally cleaned up on reboot or shut down. Old files in it could be cleaned up by a cron/systemd timer task.

An addendum by @telcoM: "On distros using systemd, you might find systemd-tmpfiles cleaning the temporary files, triggered by systemd-tmpfiles-clean.timer and configurable by a tmpfiles.d directories under /usr/lib/ (distribution's standard config), /etc/ (local customizations) and /run/ (non-persistent configuration). RHEL 7 (and newer?) use this mechanism to auto-clean any files that have not been modified in 30 days from /tmp."

what happens to the living host whenever the /tmp folder is flooded (put to the max storage capacity)

Nothing much, most Linux utilities/services don't actively write to /tmp. If they do, it's solely application dependent.

does Linux have some sort of fail safe to this, or will it, until reboot, leave the files there?

No failsafe that I'm aware of. It's your responsibility as a user.

1
  • 1
    On distros using systemd, you might find systemd-tmpfiles cleaning the temporary files, triggered by systemd-tmpfiles-clean.timer and configurable by a tmpfiles.d directories under /usr/lib/ (distribution's standard config), /etc/ (local customizations) and /run/ (non-persistent configuration). RHEL 7 (and newer?) use this mechanism to auto-clean any files that have not been modified in 30 days from /tmp, and that caused us a bit of a surprise at work. Fortunately we had backups. A lesson to not leave anything important in /tmp for sure.
    – telcoM
    Mar 8 at 19:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .