Cybertek Defense Nextcloud Nextcloud Files Not Showing or not Indexing

Nextcloud Files Not Showing or not Indexing

0 Comments 10:03 am

I have run into this issue many times where I have uploaded data, files, images, etc. into my Nextcloud instance. Other times, I have also recreated my Nextcloud instance due to corruption and then attached my Nextcloud files (all the documents, images, user related data) to the new instance, only to find out that nothing is showing up when I login to the Nextcloud app with my profile.

Some things to note is that this can occur with a docker or also a VM setup of Nextcloud. The differences being that your user data might be located elsewhere on another drive, while the Nextcloud instance is also on a different drive. The instance and user data is typically never on the same drive due to software or data corruption that could occur with the instance which you wouldn’t want to go through the hassle of digging in the software folders for Nextcloud to scavenge for the correct user data. By keeping the user data separate, you can quickly recreate a Nextcloud instance.

When your Nextcloud instance crashes or files disappear despite having just uploaded papers a moment before, it might be rather unsettling at first. I now understand that Nextcloud will only by default index and catalogue files added via their system. When you need to use other tools to synchronize folders or perform mass transfers, this becomes problematic.

You may tell Nextcloud to automatically scan and detect any files added within the folders it utilizes, even when not added through one of their interfaces, by making a little update to the config file, even though it doesn’t work right out of the box. Although I personally use UNRAID with this, the procedure ought to be the same regardless of the install environment.

There are a few ways to go about fixing this issue…

  1. Go into your Unraid file share system and find the “Config.php” file and change how often you want Nextcloud to scan your file system for new files.
  2. Run an OCC script on your nextcloud console in unraid to scan your files

Option 1: Modify your Config.php file

You can modify this file either through the command line or through the Unraid file structure. If you have the ability to modify files within Unraid via the webapp, this seems to be the quickest method. Otherwise you need to find where your config.php file lives using commands in the console which can be a bit cumbersome.

I have found that the config.php file lives in this location on Unraid.

  1. Go to your “Main” page
  2. Under your array’s, select the disk which your “appdata” folder lives on. This is the folder which Nextcloud (if using a docker) would be located for its system files. You may also be using a cache drive which sometimes, the appdata folder might have multiple locations if you do not move cache data to a physical spinning disk.
  3. After opening the disk, you should see a list of different folders on this drive. You should see “appdata” folder, open it
  4. You should now see a list of all your docker system folders, open the “nextcloud” folder
  5. You want to then open the “www” folder for nextcloud
  6. There should be a “nextcloud” folder under the “www” folder, open this
  7. Open the last folder here which is called “config”
  8. If you can edit files in Unraid, you should be able to open the “config.php” file, not the config.sample.php file (this is your config template file in case something goes wrong)
  9. Once the config file is opened, enter the following at the bottom of the file after the semi-colon “);”
/**
 * Define how often filesystem changes are detected
 * Specifies how often the local filesystem (the ownCloud data/ directory, and
 * NFS mounts in data/) is checked for changes made outside ownCloud. This
 * does not apply to external storages.
 *
 * 0 -> Never check the filesystem for outside changes, provides a performance
 * increase when it's certain that no changes are made directly to the
 * filesystem
 *
 * 1 -> Check each file or folder at most once per request, recommended for
 * general use if outside changes might happen.
 */
'filesystem_check_changes' => 1,

Note that this will only work for internal storage drives. Also, the default command for “filesystem_check_changes” is set to 0, not 1. We need to change this to 1 so that when data is found to be modified in the system, it will automatically scan the environment.

After changing this command, restart your Nextcloud and the updated files should show.

Option 2: Run an ad-hoc command via the Nextcloud console

Other times where you don’t need to automatically scan for changes all the time, you may only need to do it in certain circumstances as mentioned where you have to recreate the Nextcloud instance and attach the user data to the new Nextcloud instance. The metadata involved seems to stay attached to the old instance which the new Nextcloud instance needs to rescan the user folder before the files can be visible.

  1. open Unraid and browser to your dockers tab
  2. click on your Nextcloud docker and select Console
  3. You should not need to root or do anything else but enter the following into the console
occ files:scann --all

Depending on the size of your user data folder, it could take a few minutes to hours. With a couple TB of data, mine went through pretty quickly in a few minutes.

If the data does not show after doing the scan, do a reboot of you Nextcloud docker and they should become available.

Additional details about the scanning function can be found on Nextcloud’s site located here

Using the occ command — Nextcloud latest Administration Manual latest documentation