RHEL7: How to configure /tmp on tmpfs.

Share this link

Presentation

Some applications writing files in the /tmp directory can see huge improvements when memory is used instead of disk.

By default in RHEL 7 / CentOS 7, the /tmp directory resides in the logical volume/physical partition associated with /:

# df -k /tmp
Filesystem            1K-blocks    Used Available Use% Mounted on
/dev/mapper/rhel-root   3030800 1069380   1787752  38% /

Here, another way to check the configuration:

# systemctl is-enabled tmp.mount
disabled

Configuration Change

To change this behavior and put the /tmp directory on tmpfs, type:

# systemctl enable tmp.mount

Now, if you check the new configuration, this is what you get:

# df -k /tmp
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs             508988     8    508980   1% /tmp

Remember not to write big files due to the limited space and, obviously, don’t expect persistence across reboots.

Additional Resources

In the same spirit, you can read this interesting article about Managing Temporary Files.
You can also have a look at this article about Tmpfs and Bind Mounts.

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 3.80 out of 5)
Loading...

Leave a Reply

RHCSA7: Task of the day

Allowed time: 10 minutes.
Set up a default configuration HTTP server with SELinux in Enforcing mode and active firewalld configuration.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a default secure MariaDB database called maria and create a table named people with two columns respectively name varchar(20) and age int(10) unsigned.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...

Archives