June 27, 20242 yr 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 # ------------------------------------------------- # 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 Edited December 20, 20241 yr by Mainfrezzer Edit for RC-2
July 17, 20241 yr 6.12.11 released, can I safely update or do I need to wait for an update on this script?
July 18, 20241 yr Totally forgot to check 6.12.11 😅 But as stated, it does indeed run with the 6.12.10 one. Nothing has changed.
July 24, 20241 yr I'm using this script for a while now and completly forgot to update it. Still using the version 1.4 with unraid 6.12.11 and i have no errors in logs.
October 12, 20241 yr Can anyone tell me what I'm doing wrong with this? Running on 6.12.13 I get docker: Error: RAM-Disk Mod found incompatible files: 60ad47ed6cadcd544f92bd012d30a4f2 /etc/rc.d/rc.docker 99915e9e302b0df53cb3739951f4e33f /usr/local/emhttp/plugins/dynamix/scripts/monitor Edited October 12, 20241 yr by PhilBarker
October 13, 20241 yr I am I'm using this one which says it works for 6.12.13 - but it does not on mine
October 15, 20241 yr On 10/13/2024 at 9:15 PM, Kilrah said: You're sure you're not somehow running it twice? 🤦♂️you sir are a legend yes of course I had - I ran it in background whilst watching syslog but never saw any output or success message so ran it again and it error'd - so thought it wasn't working (pro-tip, doing this late at night after a zfs resilver from a failed drive, probably not wise lol) when I checked today I saw the backup messages every 30 minutes in syslog, so I stopped docker, restarted, all working as it should thank you 🙂
November 27, 20241 yr 6.12.14 & 6.12.15 # ------------------------------------------------- # RAM-Disk for Docker json/log files v1.6 for 6.12.14 # ------------------------------------------------- # check compatibility echo -e "2f2d694da7840ead41587288ea36c9b5 /etc/rc.d/rc.docker\n9f0269a6ca4cf551ef7125b85d7fd4e0 /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 January 21, 20251 yr by Mainfrezzer 6.12.15
December 6, 20241 yr On 3/8/2023 at 1:49 AM, mgutt said: create a script with the user scripts plugin which gets only executed on first array start (check the unraid version info in the script, maybe it was updated some pages later): Use the execute in the background button, to install the script the very first time. Now go to settings > docker and set docker to "no" and then to "yes" again. ZFS mirror SSD cache pool. New SSD installed last week, only 9GB files on cache pool, but already 180GB written according to SMART report. (100GB of which is in the recent few days, meaning after 'Mover' moving data from Array to Cache) Docker settings Enable container table readmore-js:Yes Docker vDisk location: (btrfs vDisk) /mnt/user/system/docker/docker.img Default appdata storage location: /mnt/user/appdata/ Docker LOG rotation: Enabled, Set to 10M I did exactly this: 0. Set all docker containers to --no-healthcheck 1. Disable Docker service. 2. Created a user script, set "At Startup of Array", copied the latest script for 6.12.14 (matched my version), save the script, click run in background. The user scripts log shows "Script Starting , then Script Finished" 3. Enable Docker service. But I still see writes of 500+ kb to cache SSD every 5 - 10 secs. What can I do now? I am seeking suggestions. Thanks! df -h /var/lib/docker/containers Filesystem Size Used Avail Use% Mounted on tmpfs 16G 9.9M 16G 1% /var/lib/docker/containers Edited December 6, 20241 yr by jena
December 6, 20241 yr Do you see "Ram-Disk enabled" in syslog, and then "backup of ramdisk" every half hour? This only affects what is logged through Docker, some containers log to their own files sparately from that, some actually do things and need to write their output... You'll never have zero writes. Edited December 6, 20241 yr by Kilrah
December 7, 20241 yr On 12/6/2024 at 3:55 AM, Kilrah said: Do you see "Ram-Disk enabled" in syslog, and then "backup of ramdisk" every half hour? This only affects what is logged through Docker, some containers log to their own files sparately from that, some actually do things and need to write their output... You'll never have zero writes. Yes, I do see "Success: Backup of RAM-Disk created." every half hour.
December 8, 20241 yr On 12/7/2024 at 12:01 PM, Kilrah said: So it's working fine and your writes come from somewhere else. If I stop all docker containers, the write to cache pool stops.
December 9, 20241 yr 11 hours ago, jena said: If I stop all docker containers, the write to cache pool stops. Precisely suggests one or more containers are writing files of their own, as mentioned this is only about logs that go through the Docker system.
December 19, 20241 yr On 12/9/2024 at 4:00 AM, Kilrah said: Precisely suggests one or more containers are writing files of their own, as mentioned this is only about logs that go through the Docker system. I narrowed down to just one docker image, Omada Controller. I was wondering if I can map the "host path 3" for the container /mnt/user/<path_to_docker_data>/omada_controller/logs/ to the same ramdisk that the OP's script created. Thanks!
December 20, 20241 yr if the logs arent *that* important, you can just map them to /tmp or /dev/shm or use the docker method with --mount type=tmpfs,destination=/WHERE-THE/LOGS-ARE-INSIDE-THE-CONTAINER/logs/,tmpfs-mode=777,tmpfs-size=128000000 Edit: And if youre as crazy as i am, and decided to run a database in ram, you can manually edit the script similar to my that syncs on start and stop of the array Edited December 20, 20241 yr by Mainfrezzer
January 10, 20251 yr 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
January 23, 20251 yr 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
January 23, 20251 yr Author 54 minutes ago, VeixES said: For me the remaining unneccesary writes to appdata are from plex mediaserver and they happen every 30 seconds constantly. Did you already disable healthcheck? Maybe this stops those writes. You have to add --no-healthcheck to extra parameters:
January 23, 20251 yr I have it with some extra stuff. --no-healthcheck --log-driver syslog --log-opt syslog-address=udp://127.0.0.1:541 Unfortunately no help. Thats why RAM-Disk seems to be easiest to reduce those writes. Edited January 23, 20251 yr by VeixES
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.