LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-22-2014, 02:44 PM   #1
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Mint, MX, antiX, SystemRescue
Posts: 2,337

Rep: Reputation: 358Reputation: 358Reputation: 358Reputation: 358
Automatically unmount samba shares when they dissappear?


I have a separate fileserver box that provides a Samba share of some generic stuff I mount to my local box as /public. If that fileserver box goes down (it doens't crash, it is cleanly shutdown when not needed for long periods), then the Samba share remains mounted on my local system and if I bring up Thunar to browse files, it hangs because of the missing Samba share. I'm not trying to look for files on that missing share, only on my local system, but Thunar still hangs. The fix is to kill Thunar, manually unmount the Samba share, and try Thunar again.

It seems like there should be an fstab entry that could handle this automatically. Something like "errors=unmount", but I don't see that documented (but I haven't tried it to see if that syntax actually works anyway). Is there an approved way for doing this?

Here is my current fstab entry:
Code:
//192.168.0.4/public   /public   smbfs   credentials=/root/.smbcredentials,errors=remount-ro   0   1
 
Old 10-23-2014, 03:41 AM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by haertig View Post
I have a separate fileserver box that provides a Samba share of some generic stuff I mount to my local box as /public. If that fileserver box goes down (it doens't crash, it is cleanly shutdown when not needed for long periods), then the Samba share remains mounted on my local system and if I bring up Thunar to browse files, it hangs because of the missing Samba share. I'm not trying to look for files on that missing share, only on my local system, but Thunar still hangs. The fix is to kill Thunar, manually unmount the Samba share, and try Thunar again.

It seems like there should be an fstab entry that could handle this automatically. Something like "errors=unmount", but I don't see that documented (but I haven't tried it to see if that syntax actually works anyway). Is there an approved way for doing this?

Here is my current fstab entry:
Code:
//192.168.0.4/public   /public   smbfs   credentials=/root/.smbcredentials,errors=remount-ro   0   1
well, you're listing your share in the global /etc/fstab, which means it is supposed to be there. Always. Period. For all I know, there is no way to mount file systems "only if" when they're in fstab.

On the other hand, what you describe is a misbehavior of Thunar for me. Once you display the root directory / in Thunar, it tries to scan all top-level directories to display the number of items in them in the "size" column. IIRC, this can be disabled (haven't used Thunar/xfce for years, so I'm not sure), which might be a workaround for you. However, Thunar shouldn't hang permanently in that case; instead, it's supposed to stall for a moment and then continue gracefully after a timeout of a few seconds, ignoring the directory that made trouble.

You might also consider using autofs instead of static mounting. Then autofs could make sure that the share is always displayed, but mounted only if you access it (and, optionally, unmounted automatically after some time when you don't). I'm doing it like that across all my machines, most of which aren't permanently on.

[X] Doc CPU

Last edited by Doc CPU; 10-23-2014 at 03:54 AM. Reason: Typo
 
  


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
[SOLVED] Where does Fedora 17 mount the samba shares automatically by default? dahweeds Linux - Newbie 1 01-11-2013 10:51 AM
LXer: Automatically mounting and unmounting Samba/Windows shares with CIFS LXer Syndicated Linux News 0 07-27-2007 12:01 PM
How to mount SAMBA shares in /etc/fstab automatically? Micro420 Linux - General 7 06-16-2006 06:24 AM
Want to refresh Samba shares automatically after Windows reboot evdm Linux - Software 2 03-08-2005 05:59 PM
Unable to unmount SMB shares reyemarr Linux - General 5 03-29-2004 03:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:29 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
Open Source Consulting | Domain Registration