1

I need to mount shared volumes from various remote servers on my local server which is running Ubuntu Server 10.10. I typically use commands like this to mount the shares:

sudo mount -t cifs //192.168.1.200/RemoteShare local_folder -o username=me,password=mypass

I used Webmin to make these mounts permanent, so they're automatically mounted at startup (not that this machine restarts very often). I'm not averse to terminal commands, but

My problem is that some of the remote servers, and one in particular, are restarted around once a week, disconnecting the shared volume.

Is there any way I can get my server to check for the mounted volume when it's needed and attempt to mount it if it's not already mounted?

Kalessin
  • 143
  • 1
  • 2
  • 6

2 Answers2

2

You should look into using automount. You basically configure automount with the mount point and the share/location and automount takes care of mounting and unmounting the share automatically and on-demand.

Because you probably don't want to keep your password in the automount maps, you can specify the user/pass combo in a file and reference it with the "crendentials=filename" option where filename is a file with username= and password= lines.

rthomson
  • 1,059
  • 9
  • 14
1

A simple bash script would do the job.

Check for a file that should exist on the share, or get the number of files in the top level directory, something to tell you the mount is working properly, otherwise remount.

Then throw the whole thing in cron.


Updated:

Then I would look at autofs, it should be available for ubuntu and as the post below me suggests, mounts the filesystem when accessed and unmounts after a period of activity.

rfelsburg
  • 767
  • 3
  • 7
  • 1
    Thanks for that idea. I was hoping for a solution that would just mount the remote volume on demand rather than checking it every x minutes, but your suggestion is a good alternative. – Kalessin Apr 12 '11 at 13:36