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

  • Author

I successfully tested the following version with Unraid 6.12.3

 

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

# check compatibility
echo -e "ce45b19ceea8837f8143b8a5b64663f2 /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\
  if [[ -d /var/lib/docker_bind ]]; then umount /var/lib/docker_bind || logger -t docker Error: RAM-Disk bind unmount failed while docker stops!; fi\
  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

 

In addition the modifications apply only if the files are compatible. This should prevent errors if Limetech changes the files in one of the future Unraid versions again.

 

  • 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

Unfortunately, even with the updated script, I still get an error message when stopping Docker:

 

Jul 28 20:03:42 smartserver root: stopping dockerd ...
Jul 28 20:03:44 smartserver root: umount: /var/lib/docker_bind: not mounted.
Jul 28 20:03:44 smartserver docker: Error: RAM-Disk bind unmount failed while docker stops!
Jul 28 20:03:44 smartserver docker: RAM-Disk removed
Jul 28 20:03:44 smartserver emhttpd: shcmd (222): umount /var/lib/docker

 

 

But the RAM-Disk seems to be created without errors when starting Docker and I also get the Success message every 30 minutes

 

Jul 28 20:06:07 smartserver root: starting dockerd ...
Jul 28 20:06:07 smartserver docker: RAM-Disk created
root@smartserver:~# mount | grep tmpfs | grep docker
tmpfs on /var/lib/docker/containers type tmpfs (rw,relatime,inode64)
tmpfs on /mnt/cache/system/docker/docker/containers type tmpfs (rw,relatime,inode64)
  • Author
3 hours ago, kennymc.c said:

Unfortunately, even with the updated script, I still get an error message when stopping Docker:

 

I've checked that and found out that the bug is even present in the older version and the last Unraid version. And actually the problematic line is doing a useless step and that's why I removed it:

 

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

# check compatibility
echo -e "ce45b19ceea8837f8143b8a5b64663f2 /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

 

 

Further explanation:

The backup part creates the directory "/var/lib/docker_bind" and a mount on it. After the backup is done the mount is removed. So it doesn't make sense to remove the mount additionally through the part which gets executed while docker is stopping (as the mount exists only while the backup is running). I think my actual idea was to remove the directory "/var/lib/docker_bind", but finally this is an absolutely unnecessary step as leaving an empty directory does not influence anything on the system. Actually this even saves the additional step to re-create the directory on the next docker start.

Is this script also useable for other system, which is using docker?

 

long story short:

i am using docker with portainer inside a LXC container (in unraid) to prevent the MACVLAN traces.

Edited by sonic6

  • 4 weeks later...
On 7/27/2023 at 1:10 AM, mgutt said:

In addition the modifications apply only if the files are compatible. This should prevent errors if Limetech changes the files in one of the future Unraid versions again.

 

Looks like they did in 6.12.4 (RC18)

Aug 22 22:06:41 Unraid-1 docker: Error: RAM-Disk Mod found incompatible files: 56bd9d7d271d027f627ddc33c801b835 /etc/rc.d/rc.docker 9f093a24ae5c2e804088ed4081027112 /usr/local/emhttp/plugins/dynamix/scripts/monitor

 

Similar error here on 6.12.3:

Aug 30 07:27:29 Raider docker: Error: RAM-Disk Mod found incompatible files: ce45b19ceea8837f8143b8a5b64663f2 /etc/rc.d/rc.docker 9a14a4b89f45c32a2126a35e0c4ebcda /usr/local/emhttp/plugins/dynamix/scripts/monitor

 

-faxxe

 

I'm holding out for RAM Disk compatibility before upgrading to 6.12.

Has anyone compared the changes that seem to have been made with 6.12.4 with the previous version? Maybe it's just something that is not relevant for the script.

You can either change the checksum or delete the compatibility check. Works on 12.4


 

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

# check compatibility
echo -e "45361157ef841f9a32a984b056da0564 /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 by Mainfrezzer

  • 1 month later...
On 9/3/2023 at 11:09 PM, Mainfrezzer said:

You can either change the checksum or delete the compatibility check. Works on 12.4


 

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

# check compatibility
echo -e "45361157ef841f9a32a984b056da0564 /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

 

I am on 6.12.4, going to try this script. Was on 6.9.x and the old script worked great. With this new script, do I still need to edit the Paraments on my Dockers individually and extra line of code @mgutt @Mainfrezzer? BTW, how do you get the checksum for this script? I see two unique checksum codes. Thank you!

Edited by pervin_1

Wondering if anyone can help me with questions above? Thanks! 

16 hours ago, pervin_1 said:

Wondering if anyone can help me with questions above? Thanks! 

 

If you look at this line:

echo -e "45361157ef841f9a32a984b056da0564 /etc/rc.d/rc.docker\n9f0269a6ca4cf551ef7125b85d7fd4e0 /usr/local/emhttp/plugins/dynamix/scripts/monitor" | md5sum --check --status && compatible=1

 

There are two files in the format of "md5_checksum path_to_file":

45361157ef841f9a32a984b056da0564 /etc/rc.d/rc.docker

9f0269a6ca4cf551ef7125b85d7fd4e0 /usr/local/emhttp/plugins/dynamix/scripts/monitor

 

You can use md5sum to generate new checksums on those two files, like:

md5sum /etc/rc.d/rc.docker

 

Sounds like @Mainfrezzer's code already includes the new checksums for 6.12.4. But you can double check yourself if you want.

Edited by Phoenix Down

On 10/9/2023 at 11:33 AM, Phoenix Down said:

 

If you look at this line:

echo -e "45361157ef841f9a32a984b056da0564 /etc/rc.d/rc.docker\n9f0269a6ca4cf551ef7125b85d7fd4e0 /usr/local/emhttp/plugins/dynamix/scripts/monitor" | md5sum --check --status && compatible=1

 

There are two files in the format of "md5_checksum path_to_file":

45361157ef841f9a32a984b056da0564 /etc/rc.d/rc.docker

9f0269a6ca4cf551ef7125b85d7fd4e0 /usr/local/emhttp/plugins/dynamix/scripts/monitor

 

You can use md5sum to generate new checksums on those two files, like:

md5sum /etc/rc.d/rc.docker

 

Sounds like @Mainfrezzer's code already includes the new checksums for 6.12.4. But you can double check yourself if you want.

Ran two md5sum checks on rc.docker and scripts monitor, the checksums are different. Which means I should change the compatibility code, correct? 

 

Thank you!

2 hours ago, pervin_1 said:

Ran two md5sum checks on rc.docker and scripts monitor, the checksums are different. Which means I should change the compatibility code, correct? 

 

Thank you!

If your Unraid version is different than @Mainfrezzer's code example, then it's possible those files are also different. So yes, you should update the RAM DIsk code with your own checksums. Note that doing this doesn't mean the RAM Disk code won't have any issues, just that the code won't abort itself. It might or might not have any issues, but we don't know until someone tries it out whenever a few version of Unraid comes out.

On 10/12/2023 at 3:49 PM, Phoenix Down said:

If your Unraid version is different than @Mainfrezzer's code example, then it's possible those files are also different. So yes, you should update the RAM DIsk code with your own checksums. Note that doing this doesn't mean the RAM Disk code won't have any issues, just that the code won't abort itself. It might or might not have any issues, but we don't know until someone tries it out whenever a few version of Unraid comes out.

It’s the same version. I did run without the compatibility check, and everything is working from what I see. The RAM disk shows is created in the logs. But I am gonna update it and run again. 
 

I remember we used to change the settings for each docker and added additional parameters. It sounds like is no longer the case with the updated script? 

On 10/12/2023 at 3:49 PM, Phoenix Down said:

If your Unraid version is different than @Mainfrezzer's code example, then it's possible those files are also different. So yes, you should update the RAM DIsk code with your own checksums. Note that doing this doesn't mean the RAM Disk code won't have any issues, just that the code won't abort itself. It might or might not have any issues, but we don't know until someone tries it out whenever a few version of Unraid comes out.

I am on the 12.4, and updated the compatibility code with my own checksums, and it got aborted upon the boot

 

Error: RAM-Disk Mod found incompatible files: 45361157ef841f9a32a984b056da0564 /etc/rc.d/rc.docker 9f0269a6ca4cf551ef7125b85d7fd4e0 /usr/local/emhttp/plugins/dynamix/scripts/monitor

 

 

1 hour ago, pervin_1 said:

I am on the 12.4, and updated the compatibility code with my own checksums, and it got aborted upon the boot

 

Error: RAM-Disk Mod found incompatible files: 45361157ef841f9a32a984b056da0564 /etc/rc.d/rc.docker 9f0269a6ca4cf551ef7125b85d7fd4e0 /usr/local/emhttp/plugins/dynamix/scripts/monitor

 

 

Check to make sure you copy and pasted the correct checksums into the RAM disk script. Maybe you missed a digit at the end.

1 hour ago, Phoenix Down said:

Check to make sure you copy and pasted the correct checksums into the RAM disk script. Maybe you missed a digit at the end.

I went ahead and left the checksums from @Mainfrezzer's script unchanged. Its weird that I initially changed the checksums with my own, and the script aborted itself and threw the error code from @Mainfrezzer's original checksum codes, IDK why. Everything it seems to be working now. I still get about ~5Gb writen per day. But without the script, its about 32Gb daily. There are still uncessary writes, but I am very happy. My two cache drives are Pro 980 Samsung 1Tb models, and they are supposed to last about 600TBW. Which means about 300 years lol. 

 

Thank you!

 

 

Thank you!

  • 1 month later...

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 files v1.6 for 6.12.5
# -------------------------------------------------

# check compatibility
echo -e "a26fd1e4fae583e52a2a80b90b3d5500 /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 by Mainfrezzer

This seems like a great option for unraid. Should be added to unraid by default IMO. I haven't added it yet just because I can't be bothered to stay on top of it to ensure it works well. For example Nextcloud is already pushing its luck with the random issues it has that requires manual updates, etc.

Thank you @Mainfrezzer. The upgrade to 6.12.6 went smooth, and the RAM-DISK is working perfectly. I appreciate the effort!

  • 5 weeks later...

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
# -------------------------------------------------

# check compatibility
echo -e "8d6094c1d113eb67411e18abc8aaf15d /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 by Mainfrezzer
Works on 6.12.13

Thank you @Mainfrezzer

  • 1 month later...

I will test the script on v6.12.9 of Unraid OS. Is there anything I should change before using it so I don’t have any compatibility issues?

On 2/13/2024 at 5:40 AM, Mainfrezzer said:

6.12.7-rc2
As before, will update as we go along.

6.12.8
 

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

# check compatibility
echo -e "8d6094c1d113eb67411e18abc8aaf15d /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

 

looks good for 6.12.10

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.