Resizing the /tmp folder sometimes is a thing that needs to be done in a particular situation. For instance when you run applications that require more space to process in the temporary folder or when Not enough space on /tmp error message appears.

By default, the operating system set the /tmp size half of RAM size. But we can override it for a temporary (until reboot) and permanently.

Temporary Resize /tmp Folder

We can set the /tmp folder size with following command: mount -o remout,size=NEW_SIZE /tmp. For example, we need to increase /tmp folder to 10 gigabytes, then we can do with command below

$sudo mount -o remount,size=10G /tmp

Run df -h to verify

$df -h 
Filesystem      Size  Used Avail Use% Mounted on
dev             3.9G     0  3.9G   0% /dev
run             3.9G  1.4M  3.9G   1% /run
/dev/sda1       120G   95G   25G  80% /
tmpfs           3.9G  128M  3.8G   4% /dev/shm
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs            10G   23M   10G   1% /tmp
tmpfs           786M   16K  786M   1% /run/user/1000

If you need to change the /tmp folder very often, consider to add alias to your ~/.bashrc (for bash user) or .zshrc (for ZSH shell).

To do that, open .zshrc or .bashrc and add this alias code. Customize it according to your style / need.

alias resizetmp="sudo mount -o remount,size=10G /tmp"

Save and reopen your terminal, Now, you can resize tmp folder to 10GB just with this command


If you are not sure which shell you are working on, run echo $0, it will display current shell.

Change /tmp Folder Size Permanently

Of course we can customize the /tmp folder size permanently, that means the size stay the same after reboot. To do so, open /etc/fstab and add this entry

tmpfs   /tmp         tmpfs   rw,nodev,nosuid,size=10G          0  0

Leave a Reply

Your email address will not be published. Required fields are marked *