April 22, 2021 by aubreykloppers
Here is the problem:
My OMV running on a very old SuperMicro Dual XEON with 24GB MEM and a ton of storage became so dated that only ESXi 6 will run on it. There is a trick to get it upgraded, but my Raid controller is not supported on ESXi at all.
So I got an Intel NUC (i5 8th generation) setup as ESXi 7.0 running OMV as one of the VM’s. The OMV supplies shares for media throughout my house. The structure is:
- 2 * QNAP TS-231 devices. One a p, the other not. 2*3TB drives and 2*2TB drives. Sharing enabled.
- OMV Remote Mount Enabled/Installed.
- OMV Shares pointing to the QNAP Shared folders, mounted through the “Remote Mount” plugin.
- OMV running SMB/CISF (Samba) pointing to shares of the remote mount.
- OMV Extras installed and Docker/Portainer enabled.
- Portainer running jackett, medusa, myadmin, mysql, radarr and transmission containers.
- ps: The transmission docker is running multiple instances to separate media types (i.e. movies from series). To read on how this was done, you can refer back to my writing here: “Transmission – two instances”
Now, the problem is when a power-outage happens. The QNAP devices takes a long time to boot and by that time all the remote shares are empty and all my transmission “shares” shows up as broken. Also, once everything is back up and I remount the remote shares, not everything is working as it should. Restarting the dockers do work, but then all my “shares” within transmission is in a paused state. Quite a mess. What I came up with is the following script running in crontab on the OMV.
#!/bin/bash if grep -qs '10.0.0.199' /proc/mounts && grep -qs '10.0.0.197' /proc/mounts; then : else QNAP0=`ssh firstname.lastname@example.org "df -h /share/CACHEDEV*_DATA" | awk 'NR!=1' | wc -l` QNAP1=`ssh email@example.com "df -h /share/CACHEDEV*_DATA" | awk 'NR!=1' | wc -l` if [ $QNAP0 == 2 ] && [ $QNAP1 == 2]; then #Mount all drives when they become available: mount -a #Restart all dockers: docker restart $(docker ps -q) #Restart all torrents: docker exec -ti transmission-medusa /bin/bash -c "transmission-remote --torrent all --start" docker exec -ti transmission-radarr /bin/bash -c "transmission-remote --torrent all --start" docker exec -ti transmission-leach /bin/bash -c "transmission-remote --torrent all --start" else : fi fi
Ok, what does this all mean, you ask?
- The first line checks if the “remote mount” shared by the two QNAP devices is actually mounted. If it is, then line two’s “:” means, just do nothing.
- If the drives are not available as a local mount then run the second bit and if the mounts are not available, again, do nothing…
- If the drives are not mounted, but they are available, then mount them, restart all the dockers and un-pause all the shares 🙂
…now you can also share remote mounts on omv and check if they are mounted and then mount them when they become available. AND the added bonus, start all the docker services needed to run!