3

I have a CIFS mount in fstab which works fine, except when something goes wrong with the network or the remote server and it doesn't recover. I want the share to auto-remount in the event of failure, but from what I've read this isn't supported via fstab.

What I've done for now is move it to an autofs mount, which to be fair works well, but I've always found autofs mounts a bit laggy vs fstab (just my perception visually on the command line). Does anyone have any experience of another solution for this?

2

As far as remounting the mounts present in your /etc/fstab, you can use this method to force a remount:

$ sudo mount -a -t cifs

Per man mount:

   -t, --types vfstype
   [...]

   More than one type may be specified in a comma  separated  list.
   The  list of filesystem types can be prefixed with no to specify
   the filesystem types on which no action should be taken.   (This
   can be meaningful with the -a option.) For example, the command:

            mount -a -t nomsdos,ext

You could then put a check in a shell script which would force the mount -a -t cifs command to run based on either a scheduled time or come up with a check using inotify or something else that would verify the status of the mounts, and if it detects that they've failed, run the mount .. command I provided above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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