LinuxQuestions.org
Review your favorite Linux distribution.
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 05-13-2009, 05:35 PM   #1
Murdock1979
Member
 
Registered: Oct 2003
Distribution: Slackware Debian VectorLinux
Posts: 429
Blog Entries: 2

Rep: Reputation: 30
sshfs mount testing


Hello!

I am setting up a server with a constantly mounted sshfs directory. What is the best way to test the directory and reestablish the connection if it drops?

Thanks,
Murdock
 
Old 05-14-2009, 01:58 AM   #2
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
Code:
if [ ! -d <mount path> ] then
  <mount command>
fi
 
Old 05-14-2009, 07:03 AM   #3
estabroo
Senior Member
 
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
I don't think that'll work since your mountpoint is a directory. You could however grep for your mount point from the output of the mount command and see that it is in there and vi sshfs

mount
<excerpt of output from mount>
remote_user@host:/home/remote_user on /tmp/remote_user type fuse.sshfs (rw,nosuid,nodev,max_read=65536,user=local_user)
 
Old 05-14-2009, 07:09 AM   #4
gtparks
LQ Newbie
 
Registered: Dec 2005
Distribution: RedHat, CentOS, Fedora, Ubuntu
Posts: 10

Rep: Reputation: 2
I check for broken mounts by testing for the existence of a known file in the mounted file system. You need to make sure the file does not exist if the FS is not mounted. If the test fails then you can assume the FS is not mounted.
 
Old 05-14-2009, 08:04 AM   #5
tonytraductor
LQ Newbie
 
Registered: Sep 2008
Location: new haven, ct, usa
Distribution: Debian Stable
Posts: 8

Rep: Reputation: 0
too simplistic?

I sshfs mount my /home from my main workstation to my laptop all the time.
Maybe I'm too simplistic, but I just
cd to /media/storage where I mount it, and
ls to see the contents.
If there's nothing there, I mount it again.
Of course, I've never really had a problem keeping it mounted.

My script to mount it is

#!/bin/bash

sshfs -o mydydnsdomain:/home/me /media/storage

cd /media/storage

ls

echo "If you see your stuff, you're in..."

That way, immediately upon mounting, I see that my stuff is there.

Or, you're looking for something that automagically checks and remounts, eh?
 
Old 05-14-2009, 08:18 AM   #6
Murdock1979
Member
 
Registered: Oct 2003
Distribution: Slackware Debian VectorLinux
Posts: 429

Original Poster
Blog Entries: 2

Rep: Reputation: 30
Hello!

Well, this will be mounted on a server, so it will need to automated. However, I do not think a script should be too complicated to create. The only caveat with the script is to remember, if a connected drops, the kernel does not necessarily clear the mount from the mounted filesystem list. Accordingly, you would need to add, fusermount -u /location/of/directory before remounting it.

Thanks!
Murdock
 
  


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
Permission denied error when trying to mount image contained in sshfs mount openSauce Linux - General 2 03-08-2009 08:50 AM
nome/nautilus doesn't allow sshfs mount sarhang Linux - General 1 07-01-2008 07:04 AM
Gnome/nautilus doesn't allow sshfs mount sarhang Linux - Enterprise 1 07-01-2008 01:41 AM
problem doing sshfs mount with public key authentication Sambatyon Linux - Networking 1 06-15-2008 07:30 AM
LXer: Mount a remote file system through ssh Using sshfs LXer Syndicated Linux News 0 09-16-2007 09:00 AM

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

All times are GMT -5. The time now is 06:34 PM.

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