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
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.
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.
Leave a Reply
You must be logged in to post a comment.