Plugin remote-mount - Auto mount & reload shared folder after network failure

    • OMV 4.x
    • Plugin remote-mount - Auto mount & reload shared folder after network failure

      Hello :).

      I have installed the plugin remote-mount and setup a remote mount from a windows share via CIFS.
      It's works fine.

      I have a problem with a scenario :
      - The case of OMV start before that my share is accessible on the network or after a during a network failure, my remote mount is not mounted in OMV.
      --> So i execute the command mount -a and it's works fine (disk is OK in filesystem menu of OMV) BUT share folder created on the remote mount are empty.
      It's like the shared folder managed by OMV is not reload. How can i automate remount of remote share and reload shared folder ?

      Can you help me ?

      Thx a lot
    • I use autofs and nfs. Works fine. A bit fiddly to setup the first time. Should work with CIFS as well, but I never tried it.

      Correctly setup autofs connect to the remote share automatically when you try to access it. Amazing! I have a bunch of Odroid HC2 and it would be chaos to have them access each other without autofs. I also use autofs on my laptop and on my PC. Just convenient.

      There are instructions on howto setup autofs if you Google autofs. I belive I used some Red Hat howto the first time. Now I just install autofs on the box and copy/edit the config files.

      Note: This is completely outside OMV.
      OMV 4, 5 x ODROID HC2, 2 x 12TB, 2 x 8 TB, 1 x 500 GB SSD, GbE, WiFi mesh
    • Here are the changes I made to the autofs config files in /etc. Note that this is for nfs. You have to figure out how to do it for CIFS, If you do, please post your changes here.

      I created a nfs mount folder at /media/nfs. The auto mounted folders appear there.

      auto.master - a lot of comments and last line
      /media/nfs /etc/auto.nfs --ghost

      --ghost means that empty folders are shown. When you use them they are mounted.

      If I tried to use /media directly I couldn't get it to work.

      auto.nfs - the mount options for the remote shared folders
      nas1 -fstype=nfs4,hard,intr,nodev,nosuid,async,fsc,rsize=131072,wsize=131072 192.168.1.101:/export/nas1
      nas2 -fstype=nfs4,hard,intr,nodev,nosuid,async,fsc,rsize=131072,wsize=131072 192.168.1.102:/export/nas2
      nas3 -fstype=nfs4,hard,intr,nodev,nosuid,async,fsc,rsize=131072,wsize=131072 192.168.1.103:/export/nas3
      nas4 -fstype=nfs4,hard,intr,nodev,nosuid,async,fsc,rsize=131072,wsize=131072 192.168.1.104:/export/nas4
      synology -fstype=nfs4,hard,intr,nodev,nosuid,async,rsize=131072,wsize=131072 192.168.1.121:/volume1/nas

      When nas1 is mounted it appears as /media/nfs/nas1

      Also see: access.redhat.com/documentatio…uide/s2-nfs-config-autofs

      Again: This is all done outside OMV. But it works fine on my OMV NASes.
      OMV 4, 5 x ODROID HC2, 2 x 12TB, 2 x 8 TB, 1 x 500 GB SSD, GbE, WiFi mesh

      The post was edited 1 time, last by Adoby ().

    • I believe autofs works perfectly fine for CIFS. Just a little different configuration and options. You use auto.smb for instance. And perhaps /media/smb.

      You just need to google "use autofs with cifs"

      For instance this looks interesting:

      howtoforge.com/accessing_windo…samba_shares_using_autofs
      OMV 4, 5 x ODROID HC2, 2 x 12TB, 2 x 8 TB, 1 x 500 GB SSD, GbE, WiFi mesh

      The post was edited 1 time, last by Adoby ().

    • Instead of using autofs (sorry, not a fan), maybe OMV should use systemd's automount feature since it is already using mount unit files for the /sharedfolders bind mounts. I will have to look into this.
      omv 4.1.15 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.13
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • It would be great if the remote mount plugin could use some auto mounting mechanism. I agree that autofs is a bit fiddly. But when setup it works great. Very convenient. And something like that is almost a must if you have several servers that mount shares from each other.

      I'll check out the systemd automount you mentioned.
      OMV 4, 5 x ODROID HC2, 2 x 12TB, 2 x 8 TB, 1 x 500 GB SSD, GbE, WiFi mesh
    • scarabaeus wrote:

      I use shared folder on my CIFS mount, so i dont think that autofs autmatically reload OMV for my shared folder even if i use NFS.
      This may be easier than I thought. Just add ,noauto,x-systemd.automount after nofail in your remote mount options box and reboot. Let me know if that works.
      omv 4.1.15 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.13
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • Adoby wrote:

      I'll check out the systemd automount you mentioned.
      If you have a setup, try out the part in my previous post. Curious if that works for you. i would make it the plugin default if it does.
      omv 4.1.15 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.13
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • Adoby wrote:

      Brave! Make sure to have a current system backup
      There is very little risk in using this.

      scarabaeus wrote:

      My remote share is automount when the share is available on the network. BUT my shared folder keep empty (even if the share was already accessible before OMV boot).
      Not sure what that means. Does it mount the share if the remote server is not up at boot? I will need to setup a test environment I guess.
      omv 4.1.15 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.13
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • With these option ,noauto,x-systemd.automount.
      The remote mount is auto mount when it is accessible on the network (ex with network failure or before OMV boot before my remote share). It was not the case before, sooo good news.
      But the shared folder managed by OMV stay empty even if the remote mount is accessible or not before OMV boot (it was not the case without using these options).
    • ryecoaaron wrote:

      There is very little risk in using this.

      scarabaeus wrote:

      My remote share is automount when the share is available on the network. BUT my shared folder keep empty (even if the share was already accessible before OMV boot).
      Not sure what that means. Does it mount the share if the remote server is not up at boot? I will need to setup a test environment I guess.
      Yes. but shared folder manage by OMV are now empty
    • scarabaeus wrote:

      The remote mount is auto mount when it is accessible on the network (ex with network failure or before OMV boot before my remote share). It was not the case before, sooo good news.
      That is a good start. I need to do more testing but I think we can use systemd automount in more places to fix this. I also added the following lines to /usr/share/openmediavault/mkconf/systemd.d/sharedfolders after line 75:

      Shell-Script

      1. unitname=$(systemd-escape --path --suffix=automount "${where}")
      2. unitfile="${OMV_SYSTEMD_CUSTOM_UNITS_DIR}/${unitname}"
      3. cat <<EOF > ${unitfile}
      4. # This configuration file is auto-generated.
      5. [Unit]
      6. Description=Automount shared folder ${name} to ${where}
      7. [Automount]
      8. Where=${where}
      9. [Install]
      10. WantedBy=local-fs.target
      11. EOF
      Display All
      then
      omv-mkconf systemd
      This creates an automount file for each sharedfolder bind mount. I still don't think this will completely fix the problem but it helps. I should be able to figure the rest out with a test environment.
      omv 4.1.15 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.13
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!
    • scarabaeus wrote:

      Do yu have some news about my problem ?
      I haven't had a chance to work on it any further.
      omv 4.1.15 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.13
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!