[SOLVED] Error uploading large files

We have a NextCloud 24.0.3 on a Ubuntu 20.0.4 LTS server (64 bit) on which we have issues uploading files > 10MB despite we modified the /etc/php/7.4/apache2/php.ini with the values below:

post_max_size = 12G
upload_max_filesize = 12G
max_file_uploads = 200
max_execution_time = 1800
max_input_time = 1800

upload files up to 10MB it runs ok, but e.g. trying to upload 100MB file the user receive the error

“Error while copying file to target location (copied: -1 bytes, expected filesize: 10485760 bytes)”

The logfile report the errors below:

Fatal|webdav|Sabre\DAV\Exception: Error while copying file to target location (copied: -1 bytes, expected filesize: 10485760 bytes)
Error|no app in context|Sabre\DAV\Exception: Error while copying file to target location (copied: -1 bytes, expected filesize: 10485760 bytes)
Error|PHP Error: file_put_contents(/var/www/html/nextcloud/data/3A9230DE-E0F2-427F-BF8A-7C58877FBBCC/uploads/web-file-upload-bf374453ef4dce4abb369d05e4de3004-1690200289119/41943040.ocTransferId1506023219.part): failed to open stream: No space left on device at /var/www/html/nextcloud/lib/private/Files/Storage/Local.php#296

Note that the “data” folder has 534GB of free space and we use only the web interface, not client or directly the webdav protocol.

What could be the problem?

ALex.

After a df -i i noticed that it seems the inodes in use are 100%:

inode

Could that be the problem?

ALex.

Upon checked we have 843.009 files in var/www/html/nextcloud folder, mostly in the folders type “…/appdata_/preview/…” (there are really a lot of folders this type).

I believe that this generate the inode exhaustion.

ALex.

I resolved the issue deleting a lot of preview and rebuilding the database as below:

  1. Stop Webserver (apache / nginx)
  2. Moved the appdata_instaceName/preview folder outside the appdata folder. You can just remove it if you are confident.
  3. Run sudo -u www-data /usr/bin/php /var/www/nextcloud/occ files:scan-app-data to fix database
  4. Start Webserver and Test everything works
  5. Finish up (delete moved folder, etc).

I hope that this may help some users that are in trouble with that problem.

ALex.