Local external storage: cannot create file

Hi,
I’m having problems writing files to my external storage. It is mounted as a local storage (fyi: it is a unionfs) but every time I try to write a file I is not written. Even worse, sometimes my complete server crashes (raspberry on armbian 5.33)

I get this in my nextcloud.log:

Sabre\DAV\Exception: Could not write file contents
/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 151: OCA\DAV\Connector\Sabre\File->put(Resource id #20)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096: OCA\DAV\Connector\Sabre\Directory->createFile('Nieuw tekstbest...', Resource id #20)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('Afbeeldingen/Ni...', Resource id #20, NULL)
[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/apps/dav/appinfo/v1/webdav.php - line 80: Sabre\DAV\Server->exec()
/var/www/nextcloud/remote.php - line 164: require_once('/var/www/nextcl...')
{main}

and:

Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`,`lock`,`ttl`) SELECT ?,?,? FROM `oc_file_locks` WHERE `key` = ? HAVING COUNT(*) = 0' with params ["files\/1719f2beb9f194f23591ec97167784bb", 1, 1525714868, "files\/1719f2beb9f194f23591ec97167784bb"]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'files/1719f2beb9f194f23591ec97167784bb' for key 'lock_key_index'
/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 128: Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1015: Doctrine\DBAL\DBALException driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'INSERT INTO `oc...', Array)
/var/www/nextcloud/lib/private/DB/Connection.php - line 216: Doctrine\DBAL\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)
/var/www/nextcloud/lib/private/DB/Adapter.php - line 114: OC\DB\Connection->executeUpdate('INSERT INTO `*P...', Array)
/var/www/nextcloud/lib/private/DB/Connection.php - line 254: OC\DB\Adapter->insertIfNotExist('*PREFIX*file_lo...', Array, Array)
/var/www/nextcloud/lib/private/Lock/DBLockingProvider.php - line 119: OC\DB\Connection->insertIfNotExist('*PREFIX*file_lo...', Array, Array)
/var/www/nextcloud/lib/private/Lock/DBLockingProvider.php - line 164: OC\Lock\DBLockingProvider->initLockField('files/1719f2beb...', 1)
/var/www/nextcloud/lib/private/Files/Storage/Common.php - line 709: OC\Lock\DBLockingProvider->acquireLock('files/1719f2beb...', 1)
/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 592: OC\Files\Storage\Common->acquireLock('files/Verhalen/...', 1, Object(OC\Lock\DBLockingProvider))
/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 592: OC\Files\Storage\Wrapper\Wrapper->acquireLock('files/Verhalen/...', 1, Object(OC\Lock\DBLockingProvider))
/var/www/nextcloud/lib/private/Files/View.php - line 1927: OC\Files\Storage\Wrapper\Wrapper->acquireLock('files/Verhalen/...', 1, Object(OC\Lock\DBLockingProvider))
/var/www/nextcloud/lib/private/Files/View.php - line 2040: OC\Files\View->lockPath('/Verhalen/Verha...', 1)
/var/www/nextcloud/lib/private/Files/View.php - line 1134: OC\Files\View->lockFile('/Verhalen/Verha...', 1)
/var/www/nextcloud/lib/private/Files/View.php - line 987: OC\Files\View->basicOperation('fopen', 'Verhalen/Verhal...', Array, 'r')
/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 335: OC\Files\View->fopen('Verhalen/Verhal...', 'rb')
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 85: OCA\DAV\Connector\Sabre\File->get()
[internal function] Sabre\DAV\CorePlugin->httpGet(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method GET', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/apps/dav/lib/Server.php - line 283: Sabre\DAV\Server->exec()
/var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35: OCA\DAV\Server->exec()
/var/www/nextcloud/remote.php - line 164: require_once('/var/www/nextcl...')
{main} 

Both are Fatal. Any ideas how I can get write access (strangely it is not possible to enter login information?)

kr,
wouter