Unmounting SAMBA shares

Using applications, configuring, problems
Post Reply
Message
Author
GeoffS
Posts: 427
Joined: Fri 24 Feb 2006, 08:39
Location: Australia

Unmounting SAMBA shares

#1 Post by GeoffS »

I'm trying to automate the unmounting of my SAMBA shares.

The shares are all on my server and are mounted manually. No problem there, if they are not mounted things don't work :lol: and one click on the 'Server Mount' icon on the desktop and (provided the server has been booted) all is OK.
BUT unmounting is another issue. No easy reminder there until you become aware of the missing data in a subsequent boot.

Can I just put the smbumount commands (or better a call to my current 'Server Unmount' script) at the start of rc.shutdown and be confident that the unmounts will be completed before 'poweroff' occurs?

Am I missing something, does rc.shutdown unmount the shares? Is my occasional missing data the result of something else?

Geoff

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#2 Post by Béèm »

I am not sure of this, but if rc.shutdown tries to umount a share, which is still in use, I don't think there is an error message and I think the script continues.
In that case you could loose data.

So if you make a script yourself to be called in the rc.shutdown, make sure you do a test to see if the share is really unmounted before having the rc.shutdown to continue.

To avoid any surprises, I unmount my shares manually and make sure it's done really.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

GeoffS
Posts: 427
Joined: Fri 24 Feb 2006, 08:39
Location: Australia

#3 Post by GeoffS »

Thanks Beem
You've confirmed my worries.
Currently I also manually unmount everything.
The problem is that in future I may not be the only one required to shutdown the system. Not that I claim to always remember everything :D Hence the desire to make it automatic.

Are you sure that rc.shutdown does unmount shares? Just skimming the script I didn't find any reference to shares. If it does, maybe some tests should be put in there.

Currently the household rule is to make sure that ALL tasks on the task bar should be closed before shutting down. Having multiple screens available does make this less than reliable.

I have only written very simple scripts and have no idea how I would test that an unmount had been successful. Can you give me some useful hints.

Thanks again
Geoff

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#4 Post by Béèm »

I have been thinking about this, but didn't have time to continue.

The only thing I was thinking of is execute a mount command and analyze in some way the output in a script.

If the share is still mounted, a unmount should be done, otherwise there is no problem.

It's easy to have the idea, but I don't know anything about script writing.

That's the only idea I had.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

GeoffS
Posts: 427
Joined: Fri 24 Feb 2006, 08:39
Location: Australia

#5 Post by GeoffS »

Thanks for the further comments Beem.
Needless to say but I've thought about it also however quite by chance I found that 'umount -a' actually does unmount shares.
Just 'fiddling', I entered 'umount -a' and found that my shares had gone. This, I think' means that rc.shutdown does unmount the shares but I don't believe it checks that it has worked. However rc.shutdown is supposed to stop all tasks so there is no reason why the unmounts won't work.
As we rely on that for unmounting our local shares it is probably as good as I can make it.

I think I've found the easiest method for checking that the unmounts have worked. Using the command 'mount' and then 'grep' on the output looking for the names of the shares. As these names are quite fixed this should be workable and I think my scripting inabilities :) should be able to achieve it. However it would have to be inserted into rc.shutdown and I don't want to be doing that.

Thanks for your thoughts
Geoff

Post Reply