External storage is used but nextcloud/data/user/uploads is filled with data

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:


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


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 (eg, 12.0.2): 16.0.5 (installed via snap)
Operating system and version (eg, Ubuntu 17.04): Ubuntu 18.04
Server provider: Scaleway

The issue you are facing:
I have configured an S3 external storage and it is working as expected but my local disk gets filled with data.
I am uploading hundreds of pictures to a folder on this external storage. The files get uploaded there properly but the local directory is also getting filled with a lot of data:

user@host:~$ sudo du -sh /var/snap/nextcloud/common/nextcloud/data/user/uploads
647M	/var/snap/nextcloud/common/nextcloud/data/user/uploads

The S3 storage also has around 650 MB of data.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Install Nextcloud with snap
  2. Setup a S3 external storage
  3. upload files to a folder on external storage

The output of your Nextcloud log in Admin > Logging. I get a lot of these :

{"reqId":"edited","level":3,"time":"2019-12-24T12:54:35+00:00","remoteAddr":"ipv6_addr_edited","user":"user","app":"PHP","method":"PUT","url":"\/remote.php\/dav\/files\/path_edited.JPG","message":"fclose(): supplied resource is not a valid stream resource at \/snap\/nextcloud\/16739\/htdocs\/apps\/files_external\/lib\/Lib\/Storage\/AmazonS3.php#641","userAgent":"Mozilla\/5.0 (Linux) mirall\/2.6.1git (Nextcloud)","version":""}

and a few of these:

OCP\Encryption\Exceptions\GenericEncryptionException: Bad Signature

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    1 => 
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
  'supportedDatabases' => 
  array (
    0 => 'mysql',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  'passwordsalt' => 'edited',
  'secret' => 'edited',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'edited',
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'edited',
  'installed' => true,
  'instanceid' => 'edited',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  //-- mail config edited -- 

The output of your Apache/nginx/system log in /var/log/____:

Couldn't find it.

I have just found the explanation for this folder:

So I understand that my config is OK but this folder will be cleaned only after the client sync is completed.