Corrupt files when mounting disk drive on S3

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 20.0.1 (problem continues when upgrading to 20.0.2)
Operating system: 18.04 LTS (over Azure)
Apache version: Apache 2.4.46
PHP version: 7.3.23
S3FS: 1.87

Hello guys,

I have mounted a mount point to AWS S3 for a user, configured on disk:

mount /var/www/html/nextcloud/data/user/files/external

From the Operating System I can copy files to this folder and they load without problems, all normal. However, when I upload files from Nextcloud, files get corrupted. For example, in PDF files I see:

*PDF.js v2.4.456 (compilación: 228a591c)*

*Mensaje: Invalid PDF structure.*

Images:

*“error loading image.png*”

The files get corrupted in the process of uploading to the server.

Something very curious happens to me, if I upload the same file “again”, the file loads correctly.

(1 file conflict … What files do you want to keep? " If you select both versions, a number will be added to the name of the copied file.

-New Files
-Existing files)

By selecting “New file” the file is loaded correctly.

Admin > Logging:

{"reqId":"25ySXdna683Izk8e1XsC","level":1,"time":"2020-11-19T11:22:55+00:00","remoteAddr":"ip","user":"oscar","app":"no app in context","method":"PUT","url":"/nextcloud/remote.php/webdav/external/Profilev4.9.pdf","message":"Deprecated event type for {\"[object] (OCP\\SabrePluginEvent)\":{\"*statusCode\":200,\"*message\":\"\",\"*server\":{\"[object] (OCA\\DAV\\Connector\\Sabre\\Server)\":{\"tree\":\"[object] (OCA\\DAV\\Connector\\Sabre\\ObjectTree)\",\"*baseUri\":\"/nextcloud/remote.php/webdav/\",\"httpResponse\":\"[object] (Sabre\\HTTP\\Response)\",\"httpRequest\":\"[object] (Sabre\\HTTP\\Request)\",\"sapi\":\"[object] (Sabre\\HTTP\\Sapi)\",\"*plugins\":[],\"transactionType\":null,\"protectedProperties\":{\"...\":\"Over 20 items, aborting normalization\"},\"debugExceptions\":false,\"resourceTypeMapping\":[],\"enablePropfindDepthInfinity\":true,\"xml\":\"[object] (Sabre\\DAV\\Xml\\Service)\",\"*listeners\":{\"...\":\"Over 20 items, aborting normalization\"},\"*wildcardListeners\":[],\"*listenerIndex\":[],\"*logger\":null}},\"Symfony\\Contracts\\EventDispatcher\\EventpropagationStopped\":false}}: null","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36","version":"20.0.2.2"}

config.php

<?php
$CONFIG = array (
  'instanceid' => '****',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => 'ip1',
    1 => 'ip2',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.2.2',
  'overwrite.cli.url' => 'http://ip1/nextcloud',
  'dbname' => 'db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'user',
  'dbpassword' => '***',
  'installed' => true,
  'updater.release.channel' => 'stable',
  'updater.secret' => '***',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 1,
);

Apache logs:

same test at another time

ip - - [19/Nov/2020:09:28:57 -0300] "PUT /nextcloud/remote.php/webdav/external/Profilev5.3.pdf HTTP/1.1" 201 901 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
ip - - [19/Nov/2020:09:29:01 -0300] "GET /nextcloud/index.php/apps/files/ajax/getstoragestats.php HTTP/1.1" 200 960 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
ip - - [19/Nov/2020:09:29:01 -0300] "PROPFIND /nextcloud/remote.php/dav/files/oscar/external/Profilev5.3.pdf HTTP/1.1" 207 1328 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
ip- - [19/Nov/2020:09:29:02 -0300] "GET /nextcloud/index.php/apps/files/ajax/getstoragestats.php?dir=%2Fexternal HTTP/1.1" 200 963 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"

(The same thing happens to me having the Mount point to Wasabi).

Could anyone help me, please?

Thanks,