Samba and file scan

On owncloud 8.X.
samba external storage doesn’t update the file list on the web interface when new files are added or changed.
On a forum post I found the suggestion to sun ‘occ file:scan’ by crontab.

Is nextcloud smarter or shall I always run file:scan to keep track of new file in samba external storage?

Thank you.

1 Like

Hi Sirio81,

just set

‘filesystem_check_changes’ => 1,

to your config.php as described here

Cheers, Carsten

Hi rigerCLOUD, thank you for your reply.

nice to know aobut filesystem_check_changes option!
Correct me if I’m wrong,; this is useful in case:

  • samba writes directly into data/ folder or subfolder.
  • files are changed by ssh
  • anything that changes data/ content but the sync client or the web interface

Honestly, I’m don’t sully understand what it means by “Check each file or folder at most once per request”.

  1. What request are we speaking about?
    I wish to understand how often the check is called.
  2. Does the check call ‘occ file:scan’ for all users?
    I wish to know that because, if a server has many files, it will be very heavy duty.

As of now my samba share is connected as external storage.
The “old” owncloud installation I have doesn’t deal well with the external storage.
But I have a new nextcloud test installation and it seems to update the file and folder content of the samba external storage instantly, without any trick.

In the old owncloud installation I used a work around:
I check if files has been changed within 1 minutes by command find.
If so, I run ‘occ file:scan --user myuser’.
file:scan updates also files of external storage (on owncloud).

if set to 1, Nextcloud will

...Check each file or folder at most once per request, recommended for general use if outside changes might happen.

i would suggest to mount your share into your Nextcloud data instead of using your data as external storage
as soon as having your share mounted to e.g. “nextcloud/data” you will participate of this feature and won’t have to use “file:scan” manually if data were changed outside of Nextcloud (NC client, Windows, SSH, …).

For more details please ask the developers e.g. on github.
cheers, carsten

Hi, I’m testing filesystem_check_changes option on nextcloud 12 (debian 9).
Once I set the option in config.php, the browser page gets blank.
In /var/log/apache2/error.log I see this:

[Thu Jul 06 12:06:33.541665 2017] [:error] [pid 3216] [client 192.168.1.110:33550] PHP Parse error:  syntax error, unexpected ''filesystem_check_changes'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/rovigo/config/config.php on line 33
[Thu Jul 06 12:06:52.363254 2017] [:error] [pid 3251] [client 192.168.1.110:33552] PHP Parse error:  syntax error, unexpected ''filesystem_check_changes'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/rovigo/config/config.php on line 33
[Thu Jul 06 12:07:33.504284 2017] [:error] [pid 2949] [client 192.168.1.110:33556] PHP Fatal error:  Uncaught Error: Call to a member function getLogger() on null in /var/www/rovigo/index.php:61\nStack trace:\n#0 {main}\n  thrown in /var/www/rovigo/index.php on line 61
[Thu Jul 06 12:07:33.604085 2017] [:error] [pid 3056] [client 192.168.1.110:33558] PHP Parse error:  syntax error, unexpected ''filesystem_check_changes'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/rovigo/config/config.php on line 33
[Thu Jul 06 12:07:33.620062 2017] [:error] [pid 3056] [client 192.168.1.110:33558] PHP Parse error:  syntax error, unexpected ''filesystem_check_changes'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /var/www/rovigo/config/config.php on line 33
[Thu Jul 06 12:07:40.086310 2017] [:error] [pid 2947] [client 192.168.1.110:33564] PHP Fatal error:  Uncaught Error: Call to a member function getLogger() on null in /var/www/rovigo/index.php:61\nStack trace:\n#0 {main}\n  thrown in /var/www/rovigo/index.php on line 61

The feature does exist in the ownCloud Enterprise Edition.
Did you get it running in the meantime on Nextcloud?

I tried to use it as suggested by rigerCLOUD.
This options is described in the documentation.

Did anyone find a solution to the issue of outside file changes on samba external storage not being picked up by nextcloud?

I ran into this when saving some edited files to my samba share (without using nextcloud) and then wanting to share them immediately using nextcloud. The files did not show up for hours and I was forced to run an occ files:scan. This is not a realistic option since it takes a long time to run. I imagine this is the same for others.

Is there not a way to make nextcloud automatically rescan the external files directory when you navigate to it, so that it knows for sure what files are in the directory? I’d use the filesystem_check_changes option, but the docs clearly state that this does not apply to external storage and @sirio81 notes issues with it on NC 12.

I’m on Nextcloud 12.

1 Like

If you have errors like @sirio81, please report this directly to the bug tracker on github.com/nextcloud/server/issues

Hi all, I read about an old owncloud solution to do rescan all cron job.
Based on it I create a script that will do the job for me. But it takes ages (more than 3 hours for me) to run command “files:scan --all” over all local and remote files… So I modify it today to get all external mounting points and sync only over them. It takes now much less time to do the job and also CPU load now much lower.

I test it only with Dropbox and Google drive. Please check if it works in the same way for samba, etc. Update: checked, it works with all External Shares.

Script must be executed under your nextcloud user, e.g. “www-data”.