LinuxQuestions.org
Help answer threads with 0 replies.
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 10-28-2009, 07:40 PM   #1
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Rep: Reputation: 201Reputation: 201Reputation: 201
Need help automatically UNmounting samba share


Hi all. I have two Ubuntu 9.0.4 systems that mount a samba share on a mandriva system at bootup. I achieved this by adding the mount command to the end of /etc/fstab. The problem is that when I shutdown or reboot, Ubuntu kills the network before it unmounts the shares and then hangs for a minute or more with an error relating to the fact that the shares don't respond.

Where would I add the umount command in the Ubuntu systems to unmount the directory/shares so that I avoid the error when shutting down the system.

The /etc/fstab line that mounts the share is:
#mounting //server/DATA in /home/username/DATA
//server/DATA /home/username/DATA smbfs username=sambausername,password=sambapassword 0 0


Any help is appreciated. Thank you.
 
Old 10-28-2009, 09:06 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
The shutdown cmd should be located at /sbin/shutdown, so what you could do is write a wrapper script called shutdown to do the umount, then call the binary. You'd have to rename the binary or put it in another dir.
Another option is to create a symlink at that location to your wrapper script.

Alternatively, to avoid messing with /sbin/shutdown, create an alias in your login to call your wrapper; preferred option. Add it to /etc/profile to ensure it always gets set for all users/logins.
 
Old 10-28-2009, 10:03 PM   #3
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Original Poster
Rep: Reputation: 201Reputation: 201Reputation: 201
Thanks

Not to sound rude, I just don't have enough experience with scripting or linux in general at this point to understand what you just said!

But googling I found two apparent workarounds to the problem, one involved a script and linking that I found here: http://www.jejik.com/articles/2007/0...res_with_cifs/ I understood what the point was, but not understanding what was actually going on I put that one on the back burner when I found this:

You can use the following work around:
cd /etc/rc6.d
ls -la

"You should see :
S<nr>wpa-ifupdown the nr is probably 15
and
S<nr>umountnfs.sh that nr is probably 31

Type:
sudo mv S31umountnfs.sh S14umountnfs.sh

The point is to give the umountnfs.sh a lower as your wpa-ifupdown.sh

Follow the above steps also for /etc/rc0.d (Thanks to Deb Early for the suggestion)"

I took that from here: http://blog.avirtualhome.com/2008/03...-cifs-related/which I'm pretty sure is just moving up the unmounting of the shares.... It worked like a charm, but my machine shutdown so fast it made me nervous. Did I just jump too far in the shutdown process so that I might be causing damage like just pulling the power?

Any thoughts?
 
Old 10-29-2009, 12:34 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
If it works without corrupting your files, I guess its ok. I'm curious that the file is umountnfs.sh; nfs is not the same protocol as cifs/smb. I'd check the contents.. maybe it does all network mounted types.
Nonetheless, if you do an in-place upgrade for the next version, it may well get wiped out. Something to remember.
 
Old 10-29-2009, 11:15 AM   #5
damgar
Senior Member
 
Registered: Sep 2009
Location: dallas, tx
Distribution: Slackware - current multilib/gsb Arch
Posts: 1,949
Blog Entries: 8

Original Poster
Rep: Reputation: 201Reputation: 201Reputation: 201
I tested it on some text files I created just to open them, and then shut the client down. At least on a simple text file all went well for a couple of tests. I guess I could have gone the other way and moved the network kill later, but I didn't find anyone saying this had hurt them and didn't find anyone saying moving it later worked at all so I stuck with the heard.

Also from the umountnfs.sh
PHP Code:
# Short-Description: Unmount all network filesystems except the root fs.
# Description:       Also unmounts all virtual filesystems (proc, devfs,
#                    devpts, usbfs, sysfs) that are not mounted at the
#                    top level. 
 
  


Reply


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
auto unmounting/unmapping of samba shares Avinazz Linux - Security 1 09-14-2010 10:54 AM
mount windows share export to samba share -> improve network performance tuning newuser77 Linux - Server 1 07-23-2008 12:28 PM
LXer: Automatically mounting and unmounting Samba/Windows shares with CIFS LXer Syndicated Linux News 0 07-27-2007 12:01 PM
samba unmounting problems lin00b Linux - Networking 2 08-11-2004 02:03 AM
Simple Samba Setup, Share & Not Share timmywo Linux - Software 4 07-30-2004 08:27 AM


All times are GMT -5. The time now is 08:42 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration