How to mount a CIFS share so it doesn't warn about external file modifications

This is the current fstab entry for the mount.

//qnap/share /data cifs noauto,user,username=qnap,uid=1000,gid=1000 0 0

This works fine and most of the time without any problems.

However when using some software (eg: basic text editors like gedit, or more advanced apps like PhpStorm) to open files on the share, the software reports "external file change notifications" from time to time.

The file timestamp or size doesn't change, and both this computer and the NAS have the same time set by NTP.

Does anybody know what is triggering these "external file change" notifications in basic linux text editing apps such as gedit?

Does anybody know some different mount flags that could help resolve this?

I'm interested in a fix and also interested in learning what is happening at a lower level to trigger these notifications.

Thanks, Dave

2 Answers

In your fstab, change the line to

//qnap/share /data cifs username=qnap,password=<your_pass>,_netdev,uid=1000,gid=1000 0 0

Insert your password in place of and also note _netdev. The option _netdev is always recommended for cifs mounts in fstab. This switch delays mounting until the network has been enabled, though excluding this option won't create a problem.

The warning is because you didnt provide the password during the mount.

A similar but slightly different(in the way that the credentials are stored in a file and the file is referenced in fstab) method has been described here.

Edit: Use noauto(like you did), if you wish to mount during login instead of boot. user and sync options are also optional, use them according to your needs.

5

I have the same problem with Pluma (MATE Desktop's Gedit fork); it seems to be caused by difference in resolution of file modification timestamp between local GNU/Linux machine (nanosec) and remote Windows machine (~2 sec for FAT32).

When Pluma finished writing the file, it queried and remembers modification timestamp of the file; in CIFS case, this information is cached (thus show the original nanosec time). But when time passed, cached attributes expired, and Pluma tried to check file's timestamp for external modification again, it would now get the server-side timestamp (which is rounded up to 2-sec resolution); Pluma interprets this as external modification, and displayed the warning.

I worked around this by stopping CIFS from caching file attributes: specifying actimeo=0 option in fstab:

//qnap/share /data cifs noauto,user,username=qnap,uid=1000,gid=1000,actimeo=0 0 0

So when Pluma saves the file and read the timestamp, it will always get the already-rounded server-side timestamp, and stops giving the annoying message.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like