Server: occ files:scan -all Makes all folders show that they were just changed.

Created on 30 Sep 2016  路  15Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Setup Nextcloud 10
  2. Connect to external SMB folders
  3. Use occ files:scan -all to scan for changes

    Expected behaviour

New files or folders should be shown but no changes to their last update time and date unless it did change.

Actual behaviour

All folders on SMB shares show that they were updated or modified when the scan took place.

Server configuration

Ubuntu 16.4

Web server:
Apache

Database:
MySQL

PHP version:
7.0.8

Nextcloud version: (see Nextcloud admin page)
10

Updated from an older Nextcloud/ownCloud or fresh install:
Fresh install

Where did you install Nextcloud from:
Downloaded from Nextcloud.com

Signing status:


Signing status

Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:


App list

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

The content of config/config.php:


Config report

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

or 

Insert your config.php content here
(Without the database password, passwordsalt and secret)

Are you using external storage, if yes which one: local/smb/sftp/...
SMB
Are you using encryption: yes/no
No
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
No

LDAP configuration (delete this part if not used)


LDAP config

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

Logs

Web server error log


Web server error log

Insert your webserver log here

Nextcloud log (data/nextcloud.log)


Nextcloud log

Insert your Nextcloud log here

Browser log


Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

1. to develop bug external storage

Most helpful comment

Had this issue with nc 12 too. I saw that there was a storage_mtime field with the correct values in the oc_filecache table.

Just execute this sql statement after each occ files:scan :

UPDATE oc_filecache SET mtime=storage_mtime

or from the shell :

mysql -u root -p -e "UPDATE oc_filecache SET mtime=storage_mtime" nextcloud

All 15 comments

Well the files:scan command is not recommended for daily use.

It's the only way I have been able to get Nextcloud to pick up or recognize new files placed on the smb server. With only a few files it works without but after several gigs of files have been accessed and hundreds of folders, It just doesn't seem to look any further. I do have Check for Changes set to Once every direct access. But does that mean once every access via a sync client? Because that is the access most of my clients are using. If the check for changes should be working then I believe that is also listed as a bug that I found yesterday.

Same problem. 37 GiG of data, the only way ist to use "occ files:scan -all"
Version 10.0.2

Same Here

But does that mean once every access via a sync client? Because that is the access most of my clients are using.

I think it does yes. But let's confirm by @icewind1991

The sync client only accesses the users home folder and will thus only find top level changes.

With SMB, you can run an occ command that actively listen for smb changes.

This issue will be fixed with https://github.com/nextcloud/server/pull/3449

3449 is merged, is that bug fixed ?

I scanned (occ files:scan -all) new local folders with 12.0.4 and there modification date is not correctly reported.

Well as per it's description: will rescan all files of all known users

Maybe --unscanned helps preventing that?

I dropped oc_filecache and launched occ files:scan -all --unscanned. All directory are 1s hold. I don't get why directory are managed differently than files on this.

You should not drop oc_filecache, it's not a cache but an index.
The naming can't be changed easily which is why we are still using it.

Yes thanks, I know that not a cache. I should have tested by creating a new directory. I got excited.

Had this issue with nc 12 too. I saw that there was a storage_mtime field with the correct values in the oc_filecache table.

Just execute this sql statement after each occ files:scan :

UPDATE oc_filecache SET mtime=storage_mtime

or from the shell :

mysql -u root -p -e "UPDATE oc_filecache SET mtime=storage_mtime" nextcloud

Had this issue with nc 12 too. I saw that there was a storage_mtime field with the correct values in the oc_filecache table.

Just execute this sql statement after each occ files:scan :

UPDATE oc_filecache SET mtime=storage_mtime

or from the shell :

mysql -u root -p -e "UPDATE oc_filecache SET mtime=storage_mtime" nextcloud

Briliant, works like a charm as a workaround :ok_hand: Thanks!

What would be the postgresql command that does the same?

Edit:

su - postgres
postgres@example ~ % psql
postgres=# \l
                              List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges
-----------+----------+----------+---------+---------+-----------------------
 nextcloud | something   | UTF8     | C.UTF-8 | C.UTF-8 | something=CTc/something
[snip]
(4 rows)
postgres=# \connect nextcloud
You are now connected to database "nextcloud" as user "postgres".
nextcloud=# UPDATE oc_filecache SET mtime=storage_mtime;
UPDATE 38594
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ThomasLeister picture ThomasLeister  路  3Comments

blackcrack picture blackcrack  路  3Comments

mama21mama picture mama21mama  路  3Comments

jancborchardt picture jancborchardt  路  3Comments

rullzer picture rullzer  路  3Comments