Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 // 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?

share|improve this question

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.

share|improve this answer

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.


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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.