Right size for the /tmp and how to change size?

At tmpfs - ArchWiki is said that “a tmpfs partition has its maximum size set to half of the available RAM” and it is true in my case. But i am wondering if really is needed to have that large /tmp
So i am asking which commands to run to discover right size?

Here are some details:

$ grep tmp /etc/fstab;df -h /tmp;uptime;free -h;inxi -Fazy|grep -i "swap";pamac info systemd-swap|grep Description

tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

Filesystem      Size  Used Avail Use% Mounted on
tmpfs            32G  943M   31G   3% /tmp

 16:29:04 up  4:51,  1 user,  load average: 4,07, 4,47, 4,46

               total        used        free      shared  buff/cache   available
Mem:            62Gi        55Gi       4,5Gi       1,0Gi       2,4Gi       5,2Gi
Swap:          5,1Gi       3,6Gi       1,5Gi

  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: file size: 1.02 GiB used: 1.02 GiB (99.8%) priority: 50
    file: /var/lib/systemd-swap/swapfc/1
  ID-2: swap-2 type: file size: 1.02 GiB used: 1.02 GiB (99.9%) priority: 49
    file: /var/lib/systemd-swap/swapfc/2
  ID-3: swap-3 type: file size: 1.02 GiB used: 1.02 GiB (99.3%) priority: 48
    file: /var/lib/systemd-swap/swapfc/3
  ID-4: swap-4 type: file size: 1.02 GiB used: 582.1 MiB (55.5%)
    priority: 47 file: /var/lib/systemd-swap/swapfc/4
  ID-5: swap-5 type: file size: 1.02 GiB used: 0 KiB (0.0%) priority: 46
    file: /var/lib/systemd-swap/swapfc/5
Description           : Script for creating hybrid swap space from zram swaps,

Thank you

PS: to change size, i assume to run “sudo nano /etc/fstab” and on “tmpfs /tmp” line replace “defaults,” by “defaults,size=2G,” & reboot ?


It is not the actual size, but the maximum size, and a tmpfs lives in virtual memory, which means that its contents can be paged out to disk ─ provided that you have a swap partition or swap file, of course.

That said, does the maximum size need to be so big? Well, it depends on the usage scenario. For /tmp concretely, it shouldn’t need to be very big, but by default, pamac uses /tmp for building AUR packages, and so it’s a little difficult to determine just how much would be enough as a maximum size.

There are however yet other tmpfs mounts in the system that really don’t need to be given such a large upper limit, such as /dev and /dev/shm. So perhaps the default maximum is a bit of a sloppy choice, given that some people have only very little RAM while others have huge amounts of it. But even then it is still important to note that we’re only talking of the maximum amount of virtual memory that a given tmpfs can take up ─ and also note that it is virtual memory, not RAM; there’s a difference ─ not of the actually used amount of virtual memory. Unused tmpfs memory is still usable (and used) as regular virtual memory.

Rebooting isn’t necessary. Unmounting and remounting will do just as well. :wink: