Is by default /tmp folder mounted on ram in dietpi? Is I am allowed to use this location for non critical files like plex transcoding etc. if it is allowed what will be the bash file command to delete those files periodically to regain storage. i also want to divert homeassistant log file on ram so that it reduce writing on sd card. the logs from my homeassistant are not critical, only i want whenever system restart the history file start from that event without error. i do not need previous history. something like this in configration.yml "Recorder - Home Assistant "
`
recorder:
purge_keep_days: 5
db_url: sqlite:////tmp/.homeassistant/test
exclude:
domains:
automation
updater
`
i already diverted plex transcode folder in that direction. i think it is working perfectly like this photo.
You can store there anything that is not important to survive a reboot or power loss.
There is no specific bash command to delete files periodically, but you could try something like this: How to delete files older than 30 days in Linux - TecAdmin
Normally logs are rotated with logrotation to save space, but this would require you to install the utility.
Whether it is sufficiently large (respectively your physical RAM size is) to hold HD/UHD video transcodings, at all or without triggering regular swap file usage, is a different question . By default those are stored to disk. But with sufficient RAM of course it is a great idea to do all that in RAM, also to avoid disk I/O bottlenecks. You may need to raise the /tmp tmpfs size then. You can edit /etc/fstab, the /tmp line size= option, then run mount -o remount /tmp to apply the change (contained data remains on such a remount).
@MichaIng bumping this thread because I have a doubt. I also use Plex to transcode using /tmp (although mostly audio) what happens if tmp gets “full” without rebooting? Does it cycle/clear itself?
There is no automatic mechanism to clear /tmp. Cleanup is the responsibility of each program which makes use of it. If it runs full, all write attempts to it will fail.
Not sure what Plex does if this happens during transcoding. Best would be if it removed all related transient files in /tmp, and aborted the stream with a meaningful error log, at best also at the client. Worst would be if it crashed entirely and/or left the files in /tmp in place.
Note that /tmp as tmpfs is not even a DietPi default anymore, but systemd since Trixie or so enforces it even without any /etc/fstab or RAMTMP=yes. And that default is even smaller: 50% of physical RAM, while on DietPi it is 50% RAM + swap. So to do transcoding and tasks which can require several GiB of space on disk instead of in /tmp is a very reasonable default setup. If you move it to /tmp, carefully monitor RAM and /tmp space usage during HD video streaming, and the behavior when it runs full to avoid surprises.
Audio however does not require notable space, and I doubt it makes use of the transcode dir at all, probably happens entirely in-process. Teanscoding is relevant for video streaming only, and for large resolutions in particular.