Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-16-2011, 02:09 PM   #1
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
Mounting a drive that isn't yet connected on the network

I have an external Samba network storage drive that I mount using 'mount -t cifs -o username=aaa,password=aaa //myserver /mnt/mountlocation', but I'm finding it to be a pain to enter that whole command every time I turn on that drive and connect it to my computer via the network.

I could put that command in a script and run a simple script like 'mntdrive' that would run that command for me, but is there a way to have the drive 'pre-mounted' so that if it's available on the network it's mounted?

If I put the mount command in one of the startup scripts or in fstab, would it be available at the mount location when the drive is connected if it wasn't connected when the computer was first turned on?

Or is mounting the drive manually, even if by running a script that does it for me, something I'll have to do every time I turn on that drive? Any creative ways around this? Would make things easier if it is possible. Thanks.
Old 07-16-2011, 02:15 PM   #2
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860
I have a Samba-share from my file-server in my fstab and are perfectly fine with it. Only exception: If I connect with the wireless in my laptop it is not mounted at boot-time, just because I connect with wicd. That is happening after the drives get mounted. In that case I have to mount manually.
Old 07-16-2011, 02:16 PM   #3
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977Reputation: 1977
premounted??? you want to magically use something before it exists??

OK, well firstly, just skim through your bash history for the command, no need at all to type it out. I would expect that if you hit Ctrl+r and then type "myserver" you'll find that command magically appears

as for this premounting magic, it does actually exist, it's called automount. what this does is detect when you try to access a mountable location and mount it. So it doesn't actually do what you ask, but will know how to mount the device whenever you go to the mountpoint it is meant to be at. When you don't use it for a few mintues, it automatically unmounts it again.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How can I find the IP address of connected network drive? giddensg Linux - Networking 3 04-01-2011 01:43 AM
Mounting a windows drive on a Linux machine (connected via an ethernet network) eddydw Linux - Networking 13 01-03-2009 04:13 PM
MandrivaLinux 2006 - Internet (cable) isn't always connected JBailey742 Linux - Software 0 03-24-2006 06:24 AM
Mandrake 10.0: mounting Linksys NSLU2-connected USB drive Chris Wright Linux - General 2 08-21-2005 04:43 PM
X blank screen on start when network isn't connected (RedHat 9) boris_s Linux - Software 0 01-08-2004 06:00 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:24 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration