How to Switch Debian 13 /tmp from tmpfs to disk
Every new version of an operating system comes with changes, and Debian is no different. I am going on record
that the new /tmp default in Debian 13 is a bad idea: “The temporary-files directory /tmp is now stored in a tmpfs”.
New installs of Debian 13 now uses RAM as the storage for /tmp via
tmpfs. It will use up to half of the available
memory on the system. For those spinning up VMs with only a small amount of memory, this could get bad in a hurry. Filling
up /tmp now means you are eating RAM instead of disk space.
For those who want this type of setup (tmpfs for /tmp), they could have easily opted into it already.
The good news is there is a simple way to undo this and put /tmp back on disk. Doing so will remove any files that are currently in /tmp.
$ sudo systemctl mask tmp.mount
Then you must restart the system to apply the change. You can check by looking at the output of df. If you see an entry
for /tmp under Mounted on and it says tmpfs for the Filesystem column, then you are using tmpfs for /tmp.
josephscott@debian13:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 392M 836K 391M 1% /run
/dev/vda3 59G 1.1G 55G 2% /
tmpfs 2.0G 0 2.0G 0% /dev/shm
efivarfs 256K 14K 243K 6% /sys/firmware/efi/efivars
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service
tmpfs 2.0G 0 2.0G 0% /tmp
...
If you don’t have a /tmp entry under Mounted on, then you are using disk for /tmp.
I just confirmed this process on a fresh install of Debian 13.2. It’s nice to see they didn’t make this a difficult switch. But this is a default that shouldn’t have been changed.
Don’t get me started on systemd.