Last active
March 14, 2024 16:01
-
-
Save aitseitz/b969f86c9225379fd50e47e691e20aa4 to your computer and use it in GitHub Desktop.
Temporary Directories Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This scripts enabled /tmp as RAM disc | |
function checkTmpDirectoryStatus(){ | |
echo "Check your /tmp directory" | |
df -h /tmp | |
echo "" | |
echo "Check status of systemd tmp.mount" | |
sudo systemctl status tmp.mount | |
} | |
function enableTmpDirectoyinMemory(){ | |
echo "copy tmp.mount to systemd units" | |
sudo cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount | |
echo "enabled tmp.mount" | |
sudo systemctl enable tmp.mount | |
echo "Check status of systemd tmp.mount again" | |
sudo systemctl status tmp.mount | |
} | |
checkTmpDirectoryStatus | |
#enableTmpDirectoyinMemory | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Enable /tmp directoy in RAM/Memory
Situation:
The /tmp directoy is mounted as a filesystem

this leads to performance problems if the disc is not fast enough and on fast ssd it can lead to a shorter lifetime to to massive I/O operations on /tmp
Solution:
Enable tmp.mount via Systemd:
Links:
https://forums.linuxmint.com/viewtopic.php?t=286307
https://systemd.io/TEMPORARY_DIRECTORIES/