Linux: increase the size of /tmp (tmpfs) temporarily or permanently
Enlarge a tmpfs-mounted /tmp with mount -o remount, then make it permanent via fstab or systemd.
When /tmp is mounted as tmpfs, its size is limited (by default half of the RAM). Here is how to enlarge it temporarily or permanently.
Enlarge on the fly (not persistent)
mount -o remount,size=5G /tmp/
The change is immediate, without unmounting, but it is lost at the next reboot.
Make the change permanent
With /etc/fstab:
vi /etc/fstab
tmpfs /tmp tmpfs defaults,size=5G 0 0
With systemd, if /tmp is managed by the tmp.mount unit:
systemctl edit tmp.mount
[Mount]
Options=mode=1777,strictatime,nosuid,nodev,size=5G
Notes
- These methods only apply to
/tmpmounted astmpfs(in RAM): the maximum size must stay compatible with the available memory. - Check the result with
df -h /tmp.