# Temporary files and /tmp

Why /tmp can fill up on Ubuntu 26.04 servers, and how to give large temp files room on disk

Ubuntu 26.04 keeps `/tmp` in memory instead of on disk, and caps it at half the server's RAM. On a 1 GB server that's about 470 MB, so a deploy that installs Node.js, or a job that downloads a large file into a Ruby `Tempfile`, can run out of room and fail.

Ubuntu 22.04 and 24.04 keep `/tmp` on disk, so this only affects servers running 26.04.

## Check where your /tmp lives

Log in to your server and run:

```
df -h /tmp
```

If the **Filesystem** column says `tmpfs`, `/tmp` is in memory, and **Size** is how much it can hold. Anything else means it's on disk.

## Small servers keep /tmp on disk

On servers with 2 GB of RAM or less, Hatchbox moves `/tmp` back to disk. New servers get this automatically when they're created.

For a server created before December 1, 2026, open it in Hatchbox, click **Update**, then click **Reboot**. `/tmp` is on disk from then on.

Larger servers keep `/tmp` in memory, since half their RAM is usually plenty and memory is faster.

## Use the disk for one app's temp files

If an app needs room for larger temp files on a bigger server, point its temp directory at `/var/tmp`, which is always on disk. In your app, open **Environment Variables** and add:

```
TMPDIR=/var/tmp
```

Saving restarts your app's processes, so there's nothing to deploy. Ruby's `Tempfile` and `Dir.tmpdir`, Active Storage, and most command line tools follow `TMPDIR`. Your processes, cron jobs and `hatchbox run` commands all pick it up.

You don't need this on a Docker cluster. Containers keep their own `/tmp` on disk.

## Cleanup

Ubuntu 26.04 deletes files in `/tmp` that haven't been used for 10 days, and in `/var/tmp` after 30 days. On Ubuntu 22.04 and 24.04, nothing cleans up `/var/tmp`, so only set `TMPDIR` there if you have a reason to, and make sure your code deletes its temp files when it's done.

## Resizing a server

If you make a server smaller at your provider so it ends up with 2 GB of RAM or less, click **Update** and then **Reboot** afterward to move its `/tmp` to disk. Making a small server bigger leaves `/tmp` on disk.