mgutt Posted July 26, 2023 Author Share Posted July 26, 2023 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. 3 Quote Link to comment
kennymc.c Posted July 28, 2023 Share Posted July 28, 2023 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) Quote Link to comment
mgutt Posted July 28, 2023 Author Share Posted July 28, 2023 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. 1 Quote Link to comment
sonic6 Posted July 29, 2023 Share Posted July 29, 2023 (edited) 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 July 29, 2023 by sonic6 Quote Link to comment
sonic6 Posted August 22, 2023 Share Posted August 22, 2023 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 Quote Link to comment
faxxe71 Posted August 30, 2023 Share Posted August 30, 2023 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 Quote Link to comment
Phoenix Down Posted August 30, 2023 Share Posted August 30, 2023 I'm holding out for RAM Disk compatibility before upgrading to 6.12. Quote Link to comment
kennymc.c Posted September 3, 2023 Share Posted September 3, 2023 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. Quote Link to comment
Mainfrezzer Posted September 4, 2023 Share Posted September 4, 2023 (edited) 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 September 4, 2023 by Mainfrezzer 3 Quote Link to comment
pervin_1 Posted October 5, 2023 Share Posted October 5, 2023 (edited) 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 October 6, 2023 by pervin_1 Quote Link to comment
pervin_1 Posted October 8, 2023 Share Posted October 8, 2023 Wondering if anyone can help me with questions above? Thanks! Quote Link to comment
Phoenix Down Posted October 9, 2023 Share Posted October 9, 2023 (edited) 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 October 9, 2023 by Phoenix Down Quote Link to comment
pervin_1 Posted October 12, 2023 Share Posted October 12, 2023 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! Quote Link to comment
Phoenix Down Posted October 12, 2023 Share Posted October 12, 2023 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. Quote Link to comment
pervin_1 Posted October 13, 2023 Share Posted October 13, 2023 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? Quote Link to comment
pervin_1 Posted October 20, 2023 Share Posted October 20, 2023 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 Quote Link to comment
Phoenix Down Posted October 20, 2023 Share Posted October 20, 2023 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. Quote Link to comment
pervin_1 Posted October 21, 2023 Share Posted October 21, 2023 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! Quote Link to comment
Mainfrezzer Posted November 23, 2023 Share Posted November 23, 2023 (edited) 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 December 2, 2023 by Mainfrezzer 1 6 Quote Link to comment
JustOverride Posted November 27, 2023 Share Posted November 27, 2023 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. Quote Link to comment
pervin_1 Posted December 3, 2023 Share Posted December 3, 2023 Thank you @Mainfrezzer. The upgrade to 6.12.6 went smooth, and the RAM-DISK is working perfectly. I appreciate the effort! Quote Link to comment
Mainfrezzer Posted February 13 Share Posted February 13 (edited) 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 August 23 by Mainfrezzer Works on 6.12.13 7 3 Quote Link to comment
Unraidmule Posted April 6 Share Posted April 6 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? Quote Link to comment
sonic6 Posted April 6 Share Posted April 6 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 Quote Link to comment
Recommended Posts
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.