LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   LinuxQuestions.org Member Success Stories (https://www.linuxquestions.org/questions/linuxquestions-org-member-success-stories-23/)
-   -   openSUSE Tumbleweed auto-mount network drives at boot (https://www.linuxquestions.org/questions/linuxquestions-org-member-success-stories-23/opensuse-tumbleweed-auto-mount-network-drives-at-boot-4175627931/)

TB0ne 04-18-2018 01:14 PM

openSUSE Tumbleweed auto-mount network drives at boot
 
Have a smaller system with limited drive space; in this case, a mini PC that has zero room for expansion, and is only used for conference room display purposes. Not really much to be gained by upgrading this cheap little box.

In order to have access to our internal server, I've used SSHFS to mount the remote shares. Could easily be NFS, Samba or whatever, but for this example, that's what I've used. This is a two part solution:

Step One: In /etc/NetworkManager/dispatcher.d, create a file called "netdrives" (or whatever). In it, put:
Code:

#! /bin/sh
. /etc/rc.status

case "$2" in
    up)
      /usr/local/bin/NetMount.sh
        ;;
    *)
        exit 0
        ;;
esac

Note the line bolded above; that's another script file located somewhere else, that contains your mount commands. So, when the interface comes up, it'll run this, and not before.

Step Two: Create the mount script. Can be as simple or complex as you want it; in my case, it's only several lines like this:
Code:

sudo -u user sshfs user@10.11.12.13:/some/remote/path /some/local/path -o allow_other
This will mount the shares as my 'regular' user account, allowing me full read/write.

Handy for the house, too, if you have a NAS you'd like to mount when you hook up to your home network.

Shadowmeph 12-04-2018 12:03 PM

I apologize for necroing this thread I am just wondering if this would work for mounting from Raspi 3 last year I bought one and was trying to get it to mount drives that had videos on them and I never could get it to work . and of course I dont remember the OS I was using but it had Kodi which booting automatically . I ended up just boxing the raspi 3 .

TB0ne 12-04-2018 12:28 PM

Quote:

Originally Posted by Shadowmeph (Post 5933241)
I apologize for necroing this thread I am just wondering if this would work for mounting from Raspi 3 last year I bought one and was trying to get it to mount drives that had videos on them and I never could get it to work . and of course I dont remember the OS I was using but it had Kodi which booting automatically . I ended up just boxing the raspi 3 .

No idea; if it has the same folders/items mentioned here, it'd be worth a try. You could always just lowball the whole thing, create a script that runs at boot-time, with a "sleep" in it, to allow the network time to come up, or have the script check for a successful ping of something and mount the drive(s). Lots of options.

Shadowmeph 12-04-2018 12:56 PM

thanks for replying I will digout my raspi3 and see if I can get this up and running :)


All times are GMT -5. The time now is 06:48 AM.