LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mounting a drive that isn't yet connected on the network (https://www.linuxquestions.org/questions/linux-newbie-8/mounting-a-drive-that-isnt-yet-connected-on-the-network-892063/)

veeruk101 07-16-2011 01:09 PM

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.

TobiSGD 07-16-2011 01:15 PM

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.

acid_kewpie 07-16-2011 01:16 PM

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.


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