I have a Windows share mounted on a Linux server (RHEL4) using a mount command like this:

mount  -t smbfs //server_ip/foldername /servername/foldername -o username=USERNAME,password=PASSWORD -o gid=users,dmask=777,fmask=777,rw,noatime

It stays working for weeks at a time but sometimes stops working, at which time I unmount it and mount it again. This works but the share would have been unavailable for some time before I noticed it in log files.

Is there some way that the share can be automatically remounted when it fails?

link|improve this question

50% accept rate
feedback

1 Answer

For starters I would suggest you use "mount -t cifs", if a cifs mount driver is available in RHEL4. As far as I know, any ongoing development work is now focused on this protocol instead of the smbfs type.

Secondly I would suggest you put all your options into one string, and put the username and password into a credentials file. That file can be made to have read/write permissions only for the user accounts that need it.

As far as the automatic remounting is concerned, you could write yourself a little shell script that checks whether it can see a specific file in the mounted location, and then use that to unmount/remount the partition.

link|improve this answer
Thanks, I have a script like that running once per hour, I guess I will have to run it every few minutes. – Liam Aug 12 '10 at 11:23
feedback

Your Answer

 
or
required, but never shown

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