Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

RAM-Disk for Docker status/log files

Featured Replies

1 hour ago, VeixES said:

Thank you for create script work and being source for really useful RAM-Disk for Docker logs.

 

Would it be possible to extend(or separate script/plugin) this ram-disk support for the Plex dockers database folder.

For me the remaining unneccesary writes to appdata are from plex mediaserver and they happen every 30 seconds constantly.

It happens to specific file but ramdisking that whole folder would help. So far i havent figured out the root cause of those constant "modify" actions. all regular healtchecks and scheduled actions in plex are off.

 

Thu Jan 23 19:14:48 2025 MODIFY /mnt/user/appdata/plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/ com.plexapp.plugins.library.db-wal

....

Thu Jan 23 19:16:18 2025 MODIFY /mnt/user/appdata/plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/ com.plexapp.plugins.library.db-wal

If its any similar to jellyfin, youre really out of luck :/. In jellyfin, as soon as a user is logged in(iirc correctly a firetv stick that tries to connect constantly also cause this, been a while since that device acted up), it constantly modifies the database. keeping tabs on on the user and playback and stuff like that. 

You could move your database in ram but while possible, its absolutely not recommended^^


Edit: if you *really* want to do this, well you would have to go with the manual modification from this thread and change the following lines

PLEXPATH_HERE & DATABASE_PATH_HERE should be the plex folder, /mnt/user/appdata isnt needed to add, so just "/plex/database"

/dev/shm/plexdb is just randomly chosen by me.


All you would have to do is map the docker mapping for the database from /mnt/user/appdata/plex/database to /dev/shm/plexdb

BUT BIG FAT BEWARE if your server goes off for any reason and is not properly shutdown, the database is gone. DO THIS AT YOUR OWN RISK
 

# -------------------------------------------------
# RAM-Disk for Docker json/log files v1.6 for 7.0.0
# -------------------------------------------------
# check compatibility
echo -e "5c359d63bcbd1e44299c8c9bafae7776 /etc/rc.d/rc.docker\n599b889ae544489329bfa813fd6e3765 /usr/local/emhttp/plugins/dynamix/scripts/monitor" | md5sum --check --status && compatible=1
if [[ $compatible ]]; then

  # create RAM-Disk on starting the docker service
  sed -i '/nohup/i \
  # move json/logs to ram disk\
  rsync -aH --delete /var/lib/docker/containers/ ${DOCKER_APP_CONFIG_PATH%/}/containers_backup\
  mountpoint -q /var/lib/docker/containers || mount -t tmpfs tmpfs /var/lib/docker/containers || logger -t docker Error: RAM-Disk could not be mounted!\
  rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/containers_backup/ /var/lib/docker/containers\
  logger -t docker RAM-Disk created\
  #PLEX-DB-Mod\
  rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/PLEXPATH_HERE/DATABASE_PATH_HERE/ /dev/shm/plexdb\
  logger -t Plex DB moved to RAM' /etc/rc.d/rc.docker

  # remove RAM-Disk on stopping the docker service
  sed -i '/tear down the bridge/i \
  # backup json/logs and remove RAM-Disk\
  rsync -aH --delete /var/lib/docker/containers/ ${DOCKER_APP_CONFIG_PATH%/}/containers_backup\
  umount /var/lib/docker/containers || logger -t docker Error: RAM-Disk could not be unmounted!\
  rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/containers_backup/ /var/lib/docker/containers\
  logger -t docker RAM-Disk removed\
  #PLEX-DB-Mod\
  rsync -aH --delete /dev/shm/plexdb/ ${DOCKER_APP_CONFIG_PATH%/}/PLEXPATH_HERE/DATABASE_PATH_HERE\
  logger -t Plex DB moved to Appdata' /etc/rc.d/rc.docker

  # Automatically backup Docker RAM-Disk
  sed -i '/^<?PHP$/a \
  $sync_interval_minutes=30;\
  if ( ! ((date("i") * date("H") * 60 + date("i")) % $sync_interval_minutes) && file_exists("/var/lib/docker/containers")) {\
    exec("\
      [[ ! -d /var/lib/docker_bind ]] && mkdir /var/lib/docker_bind\
      if ! mountpoint -q /var/lib/docker_bind; then\
        if ! mount --bind /var/lib/docker /var/lib/docker_bind; then\
          logger -t docker Error: RAM-Disk bind mount failed!\
        fi\
      fi\
      if mountpoint -q /var/lib/docker_bind; then\
        rsync -aH --delete /var/lib/docker/containers/ /var/lib/docker_bind/containers && logger -t docker Success: Backup of RAM-Disk created.\
        umount -l /var/lib/docker_bind\
      else\
        logger -t docker Error: RAM-Disk bind mount failed!\
      fi\
    ");\
  }' /usr/local/emhttp/plugins/dynamix/scripts/monitor

else
  logger -t docker "Error: RAM-Disk Mod found incompatible files: $(md5sum /etc/rc.d/rc.docker /usr/local/emhttp/plugins/dynamix/scripts/monitor | xargs)"
fi

 

Edited by Mainfrezzer

  • 1 month later...
  • Replies 110
  • Views 30k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Mainfrezzer
    Mainfrezzer

    6.12.7-rc2 As before, will update as we go along. 6.12.10 up to 6.12.13   # ------------------------------------------------- # RAM-Disk for Docker json/log files v1.6 for 6.12.10 # ---------

  • Mainfrezzer
    Mainfrezzer

    For 6.12.5-rc1 will update/edit this post as we go along For 6.12.5 (Does work with 6.12.6 aswell)   # ------------------------------------------------- # RAM-Disk for Docker json/log fil

  • Mainfrezzer
    Mainfrezzer

    For 7.0.0-beta.1 For 7.0.0-beta.2 For 7.0.0-beta.3 & 4 & RC-1 & RC-2 # ------------------------------------------------- # RAM-Disk for Docker json/log files v1.6 for 7.0.0-beta.4 #

Posted Images

Can anyone confirm the script also works with 7.0.1?

Edited by kennymc.c

latest version of the script/plugin works with 7.0.1

I can already say that the script for 7/7.0.1 won't work with 7.1.0 when it comes out. The plugin will.

 

Will edit this post with the 7.1.0 one when it comes out or at least the beta of it.


 

# -------------------------------------------------
# RAM-Disk for Docker json/log files v1.6 for 7.1.0
# -------------------------------------------------
# check compatibility
echo -e "c1b259ee25f4515c2bc9ad86139447aa /etc/rc.d/rc.docker\n599b889ae544489329bfa813fd6e3765 /usr/local/emhttp/plugins/dynamix/scripts/monitor" | md5sum --check --status && compatible=1
if [[ $compatible ]]; then

  # create RAM-Disk on starting the docker service
  sed -i '/nohup/i \
  # move json/logs to ram disk\
  rsync -aH --delete /var/lib/docker/containers/ ${DOCKER_APP_CONFIG_PATH%/}/containers_backup\
  mountpoint -q /var/lib/docker/containers || mount -t tmpfs tmpfs /var/lib/docker/containers || logger -t docker Error: RAM-Disk could not be mounted!\
  rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/containers_backup/ /var/lib/docker/containers\
  logger -t docker RAM-Disk created' /etc/rc.d/rc.docker

  # remove RAM-Disk on stopping the docker service
  sed -i '/tear down the bridge/i \
  # backup json/logs and remove RAM-Disk\
  rsync -aH --delete /var/lib/docker/containers/ ${DOCKER_APP_CONFIG_PATH%/}/containers_backup\
  umount /var/lib/docker/containers || logger -t docker Error: RAM-Disk could not be unmounted!\
  rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/containers_backup/ /var/lib/docker/containers\
  logger -t docker RAM-Disk removed' /etc/rc.d/rc.docker

  # Automatically backup Docker RAM-Disk
  sed -i '/^<?PHP$/a \
  $sync_interval_minutes=30;\
  if ( ! ((date("i") * date("H") * 60 + date("i")) % $sync_interval_minutes) && file_exists("/var/lib/docker/containers")) {\
    exec("\
      [[ ! -d /var/lib/docker_bind ]] && mkdir /var/lib/docker_bind\
      if ! mountpoint -q /var/lib/docker_bind; then\
        if ! mount --bind /var/lib/docker /var/lib/docker_bind; then\
          logger -t docker Error: RAM-Disk bind mount failed!\
        fi\
      fi\
      if mountpoint -q /var/lib/docker_bind; then\
        rsync -aH --delete /var/lib/docker/containers/ /var/lib/docker_bind/containers && logger -t docker Success: Backup of RAM-Disk created.\
        umount -l /var/lib/docker_bind\
      else\
        logger -t docker Error: RAM-Disk bind mount failed!\
      fi\
    ");\
  }' /usr/local/emhttp/plugins/dynamix/scripts/monitor

else
  logger -t docker "Error: RAM-Disk Mod found incompatible files: $(md5sum /etc/rc.d/rc.docker /usr/local/emhttp/plugins/dynamix/scripts/monitor | xargs)"
fi

 

Edited by Mainfrezzer
7.1 release

On 1/10/2025 at 7:38 AM, Mainfrezzer said:

7.0.0
 

  

# -------------------------------------------------
# RAM-Disk for Docker json/log files v1.6 for 7.0.0
# -------------------------------------------------

# check compatibility
echo -e "5c359d63bcbd1e44299c8c9bafae7776 /etc/rc.d/rc.docker\n599b889ae544489329bfa813fd6e3765 /usr/local/emhttp/plugins/dynamix/scripts/monitor" | md5sum --check --status && compatible=1
if [[ $compatible ]]; then

  # create RAM-Disk on starting the docker service
  sed -i '/nohup/i \
  # move json/logs to ram disk\
  rsync -aH --delete /var/lib/docker/containers/ ${DOCKER_APP_CONFIG_PATH%/}/containers_backup\
  mountpoint -q /var/lib/docker/containers || mount -t tmpfs tmpfs /var/lib/docker/containers || logger -t docker Error: RAM-Disk could not be mounted!\
  rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/containers_backup/ /var/lib/docker/containers\
  logger -t docker RAM-Disk created' /etc/rc.d/rc.docker

  # remove RAM-Disk on stopping the docker service
  sed -i '/tear down the bridge/i \
  # backup json/logs and remove RAM-Disk\
  rsync -aH --delete /var/lib/docker/containers/ ${DOCKER_APP_CONFIG_PATH%/}/containers_backup\
  umount /var/lib/docker/containers || logger -t docker Error: RAM-Disk could not be unmounted!\
  rsync -aH --delete ${DOCKER_APP_CONFIG_PATH%/}/containers_backup/ /var/lib/docker/containers\
  logger -t docker RAM-Disk removed' /etc/rc.d/rc.docker

  # Automatically backup Docker RAM-Disk
  sed -i '/^<?PHP$/a \
  $sync_interval_minutes=30;\
  if ( ! ((date("i") * date("H") * 60 + date("i")) % $sync_interval_minutes) && file_exists("/var/lib/docker/containers")) {\
    exec("\
      [[ ! -d /var/lib/docker_bind ]] && mkdir /var/lib/docker_bind\
      if ! mountpoint -q /var/lib/docker_bind; then\
        if ! mount --bind /var/lib/docker /var/lib/docker_bind; then\
          logger -t docker Error: RAM-Disk bind mount failed!\
        fi\
      fi\
      if mountpoint -q /var/lib/docker_bind; then\
        rsync -aH --delete /var/lib/docker/containers/ /var/lib/docker_bind/containers && logger -t docker Success: Backup of RAM-Disk created.\
        umount -l /var/lib/docker_bind\
      else\
        logger -t docker Error: RAM-Disk bind mount failed!\
      fi\
    ");\
  }' /usr/local/emhttp/plugins/dynamix/scripts/monitor

else
  logger -t docker "Error: RAM-Disk Mod found incompatible files: $(md5sum /etc/rc.d/rc.docker /usr/local/emhttp/plugins/dynamix/scripts/monitor | xargs)"
fi

Nothing has changed since the beta 3 -> rc-2 script. Just reposting it as it supersedes the 6.12.14 one

So are install instructions as follows 

-set up script in user scripts

-run in background

-stop docker

-start docker

-check logs for Ram Disk Created

 

Is it any different if you're moving from 6.12->7.0.1, can you just paste the newer script into the existing userscript or should I delete it and start over? 

Just use the plugin now.

  • 2 months later...

This script would need an update for 7.1.0 final 🙃

 

Thank you

 

56 minutes ago, faxxe71 said:

This script would need an update for 7.1.0 final

try the plugin, this should work with 7.1.0 final.

 

image.thumb.png.812c47d293d0277030a9deffb47a22a2.png

  • 1 month later...

I get an error with 7.1.4. 🤨 not compatible anymore?

-thank you

-faxxe

5 hours ago, faxxe71 said:

I get an error with 7.1.4. 🤨 not compatible anymore?

-thank you

-faxxe

better using the plugin, this will work with 7.1.14 and get changes for newer version automaticly
image.png

For future people like me, who forgot about this completely and come back to this topic to read up on what's happened:

This script is now "abandoned" and have instead been made into a plugin (Thank you Mainfrezzer!)

Go to APPS, search for "ram-disk".

Install "RAM-Disk for Docker logs" by Mainfrezzer.

If you have the script from this thread in your go file. Go in there and delete it.

If you have the script in your UserScripts. Go in there and either disable the schedule or delete the script.

Reboot your server and go to SETTINGS / RAM-DISK for Docker logs. Here you can see if it is running as it should and you can edit the backup schedule.

This is the new forum thread for the plugin: https://forums.unraid.net/topic/185193-plugin-ram-disk-for-docker-logs/

And this is the GitHub for the plugin: https://github.com/Mainfrezzer/unRAID-RAM-Disk

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.