I’m using a SSD only TrueNAS build and I have SabNZBD installed on TrueNAS via the apps (docker)
To minimise wear on the SSD’s whilst downloading and unpacking, I always used a Ramdisk for this. Whilst I can do that as well, is there any way to write directly to the RAM of TrueNAS?
That was I won’t have a pertinent Ramdisk that can sit idle for a long period, whilst I’d rather have TrueNAS have as many memory as possible
In linux that is done by using tmpfs. If you mount a file system of type tmpfs, anything written to the directory at that mountpoint it will only be stored in RAM. The amount of RAM used is only as much as is necessary to store the directory contents (see man 5 tmpfs). If files are deleted from the directory the corresponding RAM is freed as well.
You can add tmpfs to an app the following way:
Edit the application configuration
Storage Configuration
Add Storage of Type Tmpfs (Temporary directory created on the RAM)
For safety, you can set a maximum on the RAM usage
Set the mountpoint (should be an empty folder)
Of course if you’re downloads are larger than your RAM size this won’t work (especially without swapspace).
the nice thing about adding a tmpfs storage type (rather than mounting hostpath in /tmp/) is that if you stop/restart the app, it will delete anything leftover in the ramdisk.
just be aware though that on some systems (especially those with low ram) you might into the OOM killer. I have issues with this on a T110 II with 32G of RAM (yes, it’s old)… the workaround is reducing the ARC maximum… but all my other systems are fine.