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

Thread: Automatic mounting of network drives at startup

  1. #1
    Join Date
    Dec 2007
    Location
    Connecticut
    Beans
    20
    Distro
    Ubuntu 10.04 Lucid Lynx

    Automatic mounting of network drives at startup

    I'm sure this has been asked and answered 1,000 times, but I'm not very adept at the search function on this forum.

    I'm using Ubuntu 8.04 on a desktop computer that is connected to a Windows 2003 server. There are two shared folders on that server that I would like to have automatically mounted once I log in to Ubuntu. I can go into Nautilus, hit Ctrl-L, and mount them for the session, but I'd like to skip that step.

    If anybody can suggest where I can go and find information on this tactic, or write a sample script and tell me where to put it, it would be greatly appreciated.

    I have to use Samba. I've had no luck at all establishing a workable SSH route with this server.

    Thanks.

  2. #2
    Join Date
    Jan 2007
    Location
    ~/PA/USA
    Beans
    1,984
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Automatic mounting of network drives at startup

    Have you tried Places > Network ? I have mine setup as samba shares from my server and using "Windows Network - Home". I can either connect to server or use the Network Places to go to my shares.

  3. #3
    Join Date
    May 2007
    Beans
    28
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Automatic mounting of network drives at startup

    Samba shares can be automatically mounted at boot.

    Step 1. Create a mountpoint, e.g.
    Code:
    sudo mkdir /media/share
    sudo chmod 777 /media/share

    Step 2. Edit /etc/fstab
    Code:
    sudo gedit /etc/fstab
    Add something like the following:
    Code:
    //remotecomputer/share /media/share cifs user=USERNAME,password=PASSWORD,workgroup=WORKGROUP,user,noatime 0 0
    If you do not have an appropriate line in /etc/hosts for your server then just use the IP address instead, e.g. "//SERVERIP/share". Also, replace USERNAME and PASSWORD with the username and password that you use to connect to the share. If you do not use a specific username and password then you can you can just delete "user=USERNAME,password=PASSWORD,".

    Step 3. Repeat steps 1-2 as needed for all other shares.

    Step 4. Reboot and make sure everything works.

  4. #4
    Join Date
    Jul 2008
    Location
    Sweden
    Beans
    4
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Automatic mounting of network drives at startup

    Quote Originally Posted by goexplode View Post
    Samba shares can be automatically mounted at boot.

    Step 1. Create a mountpoint, e.g.
    Code:
    sudo mkdir /media/share
    sudo chmod 777 /media/share

    Step 2. Edit /etc/fstab
    Code:
    sudo gedit /etc/fstab
    Add something like the following:
    Code:
    //remotecomputer/share /media/share cifs user=USERNAME,password=PASSWORD,workgroup=WORKGROUP,user,noatime 0 0
    If you do not have an appropriate line in /etc/hosts for your server then just use the IP address instead, e.g. "//SERVERIP/share". Also, replace USERNAME and PASSWORD with the username and password that you use to connect to the share. If you do not use a specific username and password then you can you can just delete "user=USERNAME,password=PASSWORD,".

    Step 3. Repeat steps 1-2 as needed for all other shares.

    Step 4. Reboot and make sure everything works.
    Not having posted the original question, but having the same problem I attempted the solution so thoroughly described in the post quoted. The solution was exactly along the lines of my preconceptions (based on earlier experience with Linux back in the days of 1.x kernels).

    In spite of following what seems to be good advice all I get is:
    CIFS VFS: cifs_mount failed w/return code = -22

    which is not very helpful to me, and I really need to 'properly' (i.e. traditionally) mount my nework shares since the kind of 'mounting' that Nautilus executes hide the share from many programs (i.e. those that do not understand the syntax smb://192.168.100/SHARE)

    Help would be appreciated.

    Bo L

  5. #5
    Join Date
    May 2007
    Beans
    28
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Automatic mounting of network drives at startup

    See this thread for more information.

    bolewin and Pawcatuck too, be sure that you have smbfs and smbclient installed before you do what I mentioned in my previous post.

    Code:
    sudo apt-get install smbfs smbclient
    bolewin, if that doesn't solve your problems then you should probably start a new thread, don't want to hijack the OP's thread!
    Last edited by goexplode; July 20th, 2008 at 07:19 PM.

  6. #6
    Join Date
    Dec 2007
    Location
    Connecticut
    Beans
    20
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Automatic mounting of network drives at startup

    Before I get going on this, I have one question about the code line:

    It ends with 0 0. What does that mean? I'm probably just being obsessive, but that's me. I know I have smbclient, I'll make sure I have smbfs as well. (On edit:

    Code:
    /lib/modules/2.6.24-19-generic/kernel/fs/smbfs
    That looks like the real deal?)

    I don't mind if bolewin hijacks this thread...just in case the same thing happens to me!

    Thanks!
    Last edited by Pawcatuck; July 20th, 2008 at 07:52 PM. Reason: looked up more information

  7. #7
    Join Date
    Jul 2008
    Location
    Sweden
    Beans
    4
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Automatic mounting of network drives at startup

    Thanks to goexplode! I had to install also the smbfs package (which is not included in the standard setup). Ironically the description of the smbclient package ends with: " If you want to mount shares exported from Microsoft Windows machines or a Samba server you must install the smbfs package." Which makes me wonder why I should want the smbclient package if I did not want to mount shares from a Samba server, and why the two packages don't come together.

    Anyway, now it all works like a charm.

    And as for Pawcatuck's question about the two zeros the answer is that:

    "The fifth field, (fs_freq), is used for these filesystems by the dump(8) command to determine which filesystems need to be dumped. If the fifth field is not present, a value of zero is returned and dump will assume that the filesystem does not need to be dumped.

    The sixth field, (fs_passno), is used by the fsck(8) program to determine the order in which filesystem checks are done at reboot time. The root filesystem should be specified with a fs_passno of 1, and other
    filesystems should have a fs_passno of 2. Filesystems within a drive will be checked sequentially, but filesystems on different drives will be checked at the same time to utilize parallelism available in the
    hardware. If the sixth field is not present or zero, a value of zero is returned and fsck will assume that the filesystem does not need to be checked."
    (quoting man fstab)

    All the Best!

  8. #8
    Join Date
    Dec 2007
    Location
    Connecticut
    Beans
    20
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Automatic mounting of network drives at startup

    Quote Originally Posted by goexplode View Post
    Samba shares can be automatically mounted at boot.

    Step 1. Create a mountpoint, e.g.
    Code:
    sudo mkdir /media/share
    sudo chmod 777 /media/share

    Step 2. Edit /etc/fstab
    [INDENT]
    Code:
    sudo gedit /etc/fstab
    Add something like the following:
    Code:
    //remotecomputer/share /media/share cifs user=USERNAME,password=PASSWORD,workgroup=WORKGROUP,user,noatime 0 0
    I have it working now!

    A couple of notes, for those who might be passing through:

    I added four shares, and they all looked something like:

    Code:
    //192.168.1.2/Workbooks /home/pawcatuck/share cifs user=Pawcatuck,password=mindyourownbusiness,workgroup=OURHOUSE,user,noatime 0 0
    In the other cases, the name "Workbooks" was replaced by the names of the Windows shares.

    I ended up with four icons and four corresponding Nautilus entries, each named "share," and each with identical contents: the last of the four. It turned out that each line overwrote the previous one, because I was writing each shared folder in turn to /home/pawcatuck/share.

    I fixed that, and it still didn't work. The solution was to rewrite fstab yet again, and then create directories with the target name, and then reboot. For instance, /home/pawcatuck/share/Workbooks, /home/pawcatuck/share/ToDoLists (not a favorite around here, but necessary), /home/pawcatuck/share/Letters. Once I created those directories, the commands that I'd put in fstab had an actual destination, so to speak, and it's working better than I could even have imagined.

    Giddy from my success, I installed about 60 Bitstream fonts from my WordPerfect discs. I'm about 99.8% of the way to Ubuntu Nirvana, and the .2% will be taken care of when I add a couple of lines to my .emacs file.

    Thanks to all who chipped in with this.
    Last edited by Pawcatuck; July 21st, 2008 at 04:05 AM. Reason: a little more clarity

  9. #9
    Join Date
    Dec 2007
    Location
    Connecticut
    Beans
    20
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Automatic mounting of network drives at startup

    Well, it's never over....

    I noticed that Ubuntu now hangs during shutdown. The last two lines were

    Code:
    CIFS VFS: server not responding
    CIFS VFS: No responce for cmd 50 mid 69
    I had to hold the "off" button on the computer, which I never like to do.

    I had the idea that if I unmounted the shared folders before shutting down, I would avoid that. But when I tried, I was told that "only root can unmount this shared volume" (or words to that effect).

    So I think I need some help with permissions...or, if there's a known way around this problem, that would be great, too.

    Thanks again.

  10. #10
    Join Date
    Dec 2007
    Location
    Connecticut
    Beans
    20
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Automatic mounting of network drives at startup

    Gaa. Just noticed that everything on the shared folders is read-only. Don't know why I didn't catch that an hour ago. Guess I really need some permissions help.

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •