LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-16-2011, 01:09 PM   #1
veeruk101
Member
 
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, 01:15 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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, 01:16 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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. http://wiki.centos.org/TipsAndTricks...c9f0dcdd688c85 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.
  


Reply



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 12:43 AM
Mounting a windows drive on a Linux machine (connected via an ethernet network) eddydw Linux - Networking 13 01-03-2009 03:13 PM
MandrivaLinux 2006 - Internet (cable) isn't always connected JBailey742 Linux - Software 0 03-24-2006 05:24 AM
Mandrake 10.0: mounting Linksys NSLU2-connected USB drive Chris Wright Linux - General 2 08-21-2005 03:43 PM
X blank screen on start when network isn't connected (RedHat 9) boris_s Linux - Software 0 01-08-2004 05:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:42 PM.

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