Skip to main content

Live Database Files can Get Corrupted by Sync

Some research workflows use an embedded, file-based database — DuckDB (.duckdb), SQLite (.db/.sqlite), or similar — where the "database" is just a single file that a running process reads from and writes to directly, rather than an application or process connecting to a server via a network connection.

Why sync and live database files don't mix

Nextcloud's desktop sync client (and any generic file-sync tool) works by watching for a file to stop changing, then uploading the new version. A live database file can be partially written at the moment the sync client uploads it, or locked by the database process while the sync client tries to read it — either way, the copy that ends up on the server (and on every other synced device) can end up corrupted or out of date. This isn't a Nextcloud-specific bug — it's a general property of syncing any file that a process keeps open and modifies in place.

warning

If your project uses a shared .duckdb, .sqlite, .accdb or similar live database file, do not put it in a folder synced by the Nextcloud desktop client. Corruption may not be obvious immediately — you may not notice until a query fails or returns wrong results.

The fix: use a direct mount, not a sync

Shared database files need a direct NetApp mount (SMB or NFS) rather than a Nextcloud-synced folder. A direct mount reads and writes the file in place over the network, the same way a local disk would, without an intermediate "detect changes and re-upload" step.

Mounting Nextcloud as a Local Drive covers WebDAV access, which doesn't solve this either, despite giving you a mounted drive: WebDAV (and the davfs2 mount it's usually implemented through) doesn't support the file-locking semantics that embedded databases rely on to coordinate concurrent access safely. For live database files, the NetApp mount is the supported option.

Needs confirmation: the actual request process for a direct NetApp mount (who to contact, what information to provide) so this page can give concrete steps rather than just naming the fix.