Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Automatic Mount of NAS

  1. #1
    Join Date
    Dec 2007
    Location
    Cebu, Philippine
    Beans
    173
    Distro
    Lubuntu 20.04 Focal Fossa

    Question Automatic Mount of NAS

    I am very new to Linux, using Ubuntu 9.10 and enjoying the experience.

    My Ubuntu computer is connected to my WLAN. On this WLAN, I also have a network attached storage (NAS) FreeBSD with FreeNAS. My current method to connect to the NAS must be done each time I log in to Ubuntu and consists of-
    • Places > Network - displaying the network:/// file browser.
    • Double click the NAS icon - displaying the smb://nas.local/ file browser.
    • Double click the Data icon - displaying the smb://nas.local/data/ file browser, mounts the drive and places a "data on nas.local" icon on the desktop.

    I then close the file browser and, whenever I want to access the data on my NAS, double click the desktop icon to access the contents of my NAS.

    What I would like to do is have this whole process automated so that it occurs at my login and I don't have to go through the process with each login.

    Is this possible and how can it be done?

  2. #2
    Join Date
    Oct 2005
    Location
    De Kwakel - Holland
    Beans
    3,657

    Re: Automatic Mount of NAS

    Quote Originally Posted by rbscairns View Post
    Is this possible and how can it be done?
    Yes, possible indeed..

    This is one of my entries in /etc/fstab for connecting to a Synology ds207+ NAS Device
    Code:
    //<IP_TO_NAS>/shared_folder /mnt/myfolder cifs user,uid=1000,rw,suid,credentials=/etc/credentials 0 0
    The shared_folder is the location on the NAS you need to have mounted, not sure how this works with your specific NAS.

    You need to create folder /mnt/myfolder (name it as you wish)..
    From terminal-window, like so..
    Code:
    sudo mkdir /mnt/myfolder
    Where /etc/credentials is a file holding login-data for the NAS... (again, name it as you wish)
    Syntax:
    Code:
    username=john
    password=mypassword
    Create it from terminal-window like so..
    Code:
    gksudo gedit /etc/credentials
    You need to have "smbfs" installed afaik.
    So..
    Code:
    sudo apt-get install smbfs

  3. #3
    Join Date
    Dec 2009
    Beans
    6,777

    Re: Automatic Mount of NAS

    You've got three choices as I see it.

    (1) Classic mounting as described above. It's universal in that it will work for all distros regardless of what desktop environment you happen to be running.

    (2) Once you gain access using the method you're doing right now, you could just bookmark it: Nautilus > Bookmarks > Add Bookmarks
    It will show up under "Places" in nautilus as sort of a "mapped drive" in Windows terminology. You will however have to go into Nautilus and click on the entry under "Places".

    (3) This method : Map Windows Shares Permanently with GVFS
    http://ubuntuforums.org/showthread.php?t=1186877
    It's not really confined to windows shares. It blew me away the first time I saw it. It will automatically place a mount icon on your desktop so you won't have to go into Nautilus.

  4. #4
    Join Date
    Dec 2007
    Location
    Cebu, Philippine
    Beans
    173
    Distro
    Lubuntu 20.04 Focal Fossa

    Re: Automatic Mount of NAS

    Option 1. got me lost with the first Code: entry. As I said, I am very new to Ubuntu and Linux.

    Option 2. was then tried. Problem here is that I cannot find Nautilus anywhere.

    Option 3. looked good at first. I started with-

    1. Select the "Network" option from the "Places" menu. OK

    2. Select the "Windows Network" icon. OK

    3. Select the workgroup that your share resides in. Problem

    When I double clicked on the network's icon, I get a message "Unable to mount location. Failed to retrieve share list from server". That stumped me.

    Basically, in Windows terminology, I would like to map the NAS drive to my desktop and have it reconnect automatically on login.

  5. #5
    Join Date
    Dec 2009
    Beans
    6,777

    Re: Automatic Mount of NAS

    Option 2. was then tried. Problem here is that I cannot find Nautilus anywhere.
    Nautilus is your "Home" folder. It's the file manager for gnome. It's how you're getting to "Places" now.

    When I double clicked on the network's icon, I get a message "Unable to mount location. Failed to retrieve share list from server". That stumped me.
    But you don't get that error when you do this:
    My current method to connect to the NAS must be done each time I log in to Ubuntu and consists of-
    • Places > Network - displaying the network:/// file browser.
    • Double click the NAS icon - displaying the smb://nas.local/ file browser.
    • Double click the Data icon - displaying the smb://nas.local/data/ file browser, mounts the drive and places a "data on nas.local" icon on the desktop.
    EDIT: Try this:

    Open Terminal
    Type nautilus smb://nas.local/data

    It should open up Nautilus to the data share on nas.local. From there you can explore either Option 2 or Option 3

    OR This way:

    Press Alt+F2 ( press the Alt and F2 keys at the same time )
    Type nautilus smb://nas.local/data
    Last edited by Morbius1; January 15th, 2010 at 05:29 PM.

  6. #6
    Join Date
    Dec 2007
    Location
    Cebu, Philippine
    Beans
    173
    Distro
    Lubuntu 20.04 Focal Fossa

    Re: Automatic Mount of NAS

    Morbiusd1, thank you for your guidance, I only hope that one day I can help others in a similar way.
    When I double clicked on the network's icon, I get a message "Unable to mount location. Failed to retrieve share list from server". That stumped me.
    But you don't get that error when you do this:
    My current method to connect to the NAS must be done each time I log in to Ubuntu and consists of-

    * Places > Network - displaying the network:/// file browser.
    * Double click the NAS icon - displaying the smb://nas.local/ file browser.
    * Double click the Data icon - displaying the smb://nas.local/data/ file browser, mounts the drive and places a "data on nas.local" icon on the desktop.
    No, I do not get the error message when I use the above.

    When I try this:

    Open Terminal
    Type nautilus smb://nas.local/data

    I get the same result as the quoted method above.

    I think the problem is now solved. What I did was (in Ubuntu 9.10)-

    Places > Connect to server...
    Server type: "Windows share"
    Server: nas.local
    Folder: data
    "check" Add bookmark
    Bookmasrk name: NAS

    Then Connect

    This brought the "up data on nas.local - File Browser" window and also placed in Places a "NAS" bookmark.

    Your guidance is VERY much appreciated.
    Last edited by rbscairns; January 19th, 2010 at 01:35 AM.

  7. #7
    Join Date
    Oct 2008
    Location
    From the Land Down Under.
    Beans
    29

    Re: Automatic Mount of NAS

    I've been searching an searching for days for a solution and this worked for me too!

    Now, is there a way for this process to be automated so the NAS device is mounted each time I fire up my pc?

  8. #8
    Join Date
    Dec 2009
    Beans
    6,777

    Re: Automatic Mount of NAS

    As a matter of fact there is: http://ubuntuforums.org/showthread.php?t=1186877

    It was option (3) in my earlier post.
    Last edited by Morbius1; January 20th, 2010 at 10:24 PM.

  9. #9
    Join Date
    Oct 2008
    Location
    From the Land Down Under.
    Beans
    29

    Re: Automatic Mount of NAS

    Thanks Morbius1,

    Your tutorial is easy to understand and everything worked for me....except that my NAS doesn't auto mount after logging in or restarting.

    It works if I manually enter this in a terminal..

    gvfs-mount smb://192.168.1.1/Public... or

    gvfs-mount "smb://192.168.1.1/Public"

    I am running UUE 2.5 (9.10) but this shouldn't matter should it?

  10. #10
    Join Date
    Dec 2009
    Beans
    6,777

    Re: Automatic Mount of NAS

    I don't understand the question. If you can access it by:

    gvfs-mount smb://192.168.1.1/Public

    Then you should follow the rest of the steps ( 13 - 17 ) and it should automount.

    For example:

    In the Terminal:

    Type gedit /home/nuffy/sharemount.sh

    Paste this into the GEdit window :
    Code:
    #!/bin/sh
    gvfs-mount smb://192.168.1.1/Public
    Then make the script executable:

    chmod +x
    /home/nuffy/sharemount.sh

    Then the rest of the HowTo:

    15. Now let's add the script to GNOME startup. Choose the "Startup Applications" option from the "Preferences" submenu located in the "System" menu.

    16. Select the "Add" option. Type a name of your choice in the "Name" field, browse to the path of the script in the "Command" field, and optionally add a comment to the "Comment" field. Press the "Add" button to save your settings.

    17. Now log out and log back in or restart your PC. Check the "Places" menu and the shares should be automatically mounted.
    BTW, much as I'd like to take credit for that HowTo , it is not mine it was done by NTolerance

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •