Author Topic: How to automount a network drive - linux ubuntu ?  (Read 3462 times)

castalla

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • Country: 00
  • Thanked: 48 times
How to automount a network drive - linux ubuntu ?
« on: 11:02:55 | 06 March, 2012 »
I've got a problem - defeated by pages of links via google - very confused.  Hope somebody can help:

I have a network drive which I mount from the command line:

 sudo mount -t cifs //server/folder /home/user/music

 There is no password.

 I really want to have this automounted - I know I have to edit etc/fstab, but I haven't any idea what line I should add - despite googling extensively.

 Any hints?

 Also the command should execute last after the network connections are established.
ARTICLE 50 - NOT IN MY NAME

The Resident Alien - http://residentalien.yolasite.com

m0aur

  • Guest
Re: How to automount a network drive - linux ubuntu ?
« Reply #1 on: 13:32:02 | 06 March, 2012 »
Never needed to do that when I ran Ubuntu. Just Googled and this was the first page returned. It looks like what you want.
http://www.automaticable.com/2008-01-18/how-to-mount-a-network-drive-in-ubuntu/

castalla

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • Country: 00
  • Thanked: 48 times
Re: How to automount a network drive - linux ubuntu ?
« Reply #2 on: 04:01:14 | 07 March, 2012 »
thanks... got that far under my own steam!  Then ran into a stinker:  you can't make fstab changes persistent in a live boot.  The edits are just lost on reboot

I've seen a suggestion it might stick if 12fstab is edited - haven't tried.

I wonder if adding the line to rc.local would work?
ARTICLE 50 - NOT IN MY NAME

The Resident Alien - http://residentalien.yolasite.com

drgeoff

  • Hero Member
  • *****
  • Posts: 850
  • Thanked: 31 times
Re: How to automount a network drive - linux ubuntu ?
« Reply #3 on: 06:16:36 | 07 March, 2012 »
Might be better in /etc/rcS.d.  Have a look at the README in there.

castalla

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • Country: 00
  • Thanked: 48 times
Re: How to automount a network drive - linux ubuntu ?
« Reply #4 on: 13:08:37 | 07 March, 2012 »
Works in rc.local - but I'll check out rc5.d

Thanks
ARTICLE 50 - NOT IN MY NAME

The Resident Alien - http://residentalien.yolasite.com

drgeoff

  • Hero Member
  • *****
  • Posts: 850
  • Thanked: 31 times
Re: How to automount a network drive - linux ubuntu ?
« Reply #5 on: 09:23:18 | 08 March, 2012 »
Works in rc.local - but I'll check out rc5.d

Thanks
Is your '5' a typo or is it time you visited the optician again?  :)

castalla

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • Country: 00
  • Thanked: 48 times
Re: How to automount a network drive - linux ubuntu ?
« Reply #6 on: 12:58:10 | 08 March, 2012 »
Opticians!

No wonder rc5.d didn't make any sense to me when I read the Readme!

Cheers
ARTICLE 50 - NOT IN MY NAME

The Resident Alien - http://residentalien.yolasite.com

castalla

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • Country: 00
  • Thanked: 48 times
Re: How to automount a network drive - linux ubuntu ?
« Reply #7 on: 13:20:36 | 08 March, 2012 »
here's the rcS file (can't find rcS.d)

Quote
#! /bin/sh
#
# rcS
#
# Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order
#

exec /etc/init.d/rc S

Is this where I could add the command line?
ARTICLE 50 - NOT IN MY NAME

The Resident Alien - http://residentalien.yolasite.com

drgeoff

  • Hero Member
  • *****
  • Posts: 850
  • Thanked: 31 times
Re: How to automount a network drive - linux ubuntu ?
« Reply #8 on: 02:40:46 | 09 March, 2012 »
Strange.  My Ubuntu 10.10 has /etc/rcS.d/ and your rcS file references it in the comment line.  My rcS file is the same as yours.

castalla

  • Administrator
  • Hero Member
  • *****
  • Posts: 2512
  • Country: 00
  • Thanked: 48 times
Re: How to automount a network drive - linux ubuntu ?
« Reply #9 on: 07:40:13 | 09 March, 2012 »
I'll have another look!
ARTICLE 50 - NOT IN MY NAME

The Resident Alien - http://residentalien.yolasite.com

 

anything