If your servers are expected to be up and connected most of the time, then I'd say leave the mount in place. That way you avoid some overhead establishing the connection. If, on the other hand, you have network dropouts or similar connection issues, then having an active mount might cause data loss for newly written files, because the filesystem won't be cleanly unmounted when the network goes away. It might be prudent to add the --checksum
flag to rsync
after such an unintended unmount, so that not only file modification times (assuming --times
) but file content as well gets checked. That should reduce adverse effects from forced unmounts.
To check whether something is mounted, simply grep
for it in the output of mount
.
Also note the soft
and hard
options to mount.cifs
, which will decide whether a broken connection will cause read errors or program hangs. I'm pretty sure that with the hard
option, you'd see a remote as mounted even if the connection failed. With soft
, I'm not sure at all. If you see the filesystem still mounted, then chances are good that you'll be able to access it when the connection is restored. If the connection isn't available, though, the hard
option will cause your rsync
to hang.
hard
, this will make your script hang. – MvG Jul 24 '12 at 07:30