Nextcloud and SMB solve overlapping but different problems. SMB gives computers on a trusted LAN a native network filesystem. Nextcloud adds web and mobile access, sync clients, sharing links, versions, trash, comments, activity, collaborative apps, and its own file metadata.
The risky design is to point both systems directly at Nextcloud’s internal data directory. A file changed outside Nextcloud can leave its database index, etags, shares, versions, and activity out of sync. The safe architecture gives each access path an explicit owner.
Decide Which System Is Authoritative
Choose one of three models before installing anything.
| Model | Best for | Main rule |
|---|---|---|
| TrueNAS SMB and Nextcloud use separate datasets | Existing LAN file server plus a distinct cloud workspace | Do not expose Nextcloud’s internal data through SMB |
| TrueNAS SMB is mounted as Nextcloud external storage | Users need selected SMB data in the Nextcloud interface | Treat it as secondary storage and manage external changes deliberately |
| Nextcloud is the only user-facing file service | Collaboration, sync, sharing, and metadata matter more than native SMB | Access files through Nextcloud clients/WebDAV, not a parallel share |
For most small organisations that already rely on SMB, the first model is the safest starting point. Add a controlled external mount only for a dataset that genuinely needs both interfaces.
Never Share Nextcloud’s Internal Data Directory
Nextcloud tracks files in a database-backed file cache. Direct filesystem changes do not automatically update that index. The current Nextcloud external-storage documentation explains that changes made outside Nextcloud can remain invisible until a scan occurs; deep changes and renames can also lose Nextcloud metadata.
Therefore, do not create an SMB share over:
- the Nextcloud application directory;
- its internal user-data directory;
- database storage;
- application configuration or custom-app directories;
- a dataset whose permissions are managed exclusively for the app container.
TrueNAS also recommends separating application datasets from ordinary SMB/NFS host paths. Current app layouts give application code, user data, and database state distinct storage so snapshots and permissions can be handled correctly.
Model A: Separate SMB and Nextcloud Datasets
Use a ZFS layout such as:
pool/
shares/
departments/ # exported by TrueNAS SMB
apps/
nextcloud-html/ # application/configuration
nextcloud-data/ # Nextcloud-managed files only
nextcloud-db/ # database
TrueNAS uses Samba for SMB and supports authenticated shares without requiring a Windows domain. Its current SMB reference recommends individual users so permissions and access can be attributed.
Advantages:
- SMB performance and Windows ACL behaviour remain native;
- Nextcloud controls its own data and metadata;
- snapshots and quotas can differ by workload;
- an app upgrade cannot unexpectedly change the main file-server path;
- troubleshooting has a clear ownership boundary.
The trade-off is that a file in the SMB share is not automatically present in Nextcloud. Move or copy data through a deliberate workflow, or expose only a selected share through Model B.
Model B: Mount a TrueNAS Share as External SMB Storage
Nextcloud’s bundled External Storage Support app can mount an SMB/CIFS share as secondary storage. The official SMB backend guide recommends the native PHP smbclient module for reliability and performance and documents the required host, share, authentication, optional subfolder, and user/group assignment.
Use a dedicated TrueNAS dataset and SMB share for this purpose. Create a least-privilege service identity or a carefully designed per-user authentication flow. Restrict the mount to the Nextcloud users and groups who need it; do not publish every NAS share by default.
Architecture:
LAN workstation ---- SMB ----> TrueNAS dedicated shared dataset
^
|
Nextcloud server ---- SMB client--+
|
web, mobile, and sync clients
This is a multi-writer design. Before adopting it, test simultaneous edits, file locking, case-only renames, unsupported characters, large files, office documents, ransomware recovery, and how ACL identities map between Nextcloud and TrueNAS.
Understand the External-Change Problem
When an SMB user creates, edits, moves, or deletes a file, Nextcloud may not know immediately. Its documentation distinguishes several mechanisms:
- a shallow rescan when a path is directly accessed;
- an
occ files_external:scanjob for periodic scans; - SMB change notifications through
occ files_external:notifywhere supported.
Do not assume the desktop sync client crawls the full external tree. It relies on etag changes to discover where to look. A direct SMB modification may not update parent etags, leaving a deep change undiscovered.
There is also an important platform caveat: Nextcloud states that SMB update notifications work reliably with Windows SMB servers but have limitations with Linux-based SMB servers. TrueNAS uses Samba, so validate behaviour on the exact Nextcloud, Samba, and TrueNAS versions rather than promising near-real-time detection.
If metadata such as shares, comments, tags, favourites, and activity must survive renames, make Nextcloud the write path for those folders. A scan can interpret an external rename as a deletion plus a new file.
Model C: Make Nextcloud the Only File Interface
When external sharing, sync, versions, and collaboration are primary, keep the files under Nextcloud control and install its desktop/mobile clients. Users still see local folders, but changes pass through Nextcloud’s protocol and metadata layer.
This eliminates parallel SMB writes. It may not fit applications that require a low-latency mounted filesystem, complex Windows ACLs, large shared project trees, or server-side SMB features. Test workload behaviour rather than assuming a sync folder is equivalent to a network drive.
Deploy the Application with Version-Aware Documentation
TrueNAS application architecture has changed across releases. The current TrueNAS Nextcloud integration page notes that releases 24.10 and later use a Debian-based application path, while older FreeBSD plugin instructions are being retired. Do not follow an old jail or Kubernetes tutorial on a current Docker-based release.
At deployment time, open the documentation for the installed TrueNAS release and the app version displayed in its catalogue. Prepare separate persistent datasets for application files, Nextcloud user data, and the database as requested by that release. Keep secrets out of screenshots and backup scripts.
For a manually managed Nextcloud server or VM, verify the current Nextcloud system requirements. Supported operating systems, databases, PHP releases, and recommendations change between Nextcloud generations. Copying old PHP 7 or PHP 8 tuning into a newer server is not maintenance.
Tune from Measurements, Not a Universal PHP Snippet
Set upload limits consistently across reverse proxy, web server, PHP-FPM, and Nextcloud. A large upload_max_filesize alone does not overcome request-body, timeout, proxy, or storage limits.
Measure:
- concurrent PHP-FPM workers and real memory per worker;
- database latency and slow queries;
- Redis availability for transactional file locking and caching where supported;
- background-job duration and queue;
- preview generation load;
- SMB mount latency and errors;
- free space, snapshot growth, and inode/file counts.
Use system cron for Nextcloud background jobs rather than AJAX for a multi-user production service. Size PHP-FPM from available memory and concurrency; an arbitrary high worker count can cause swapping and make uploads less reliable.
Back Up the Service as a Consistent Set
ZFS snapshots are valuable, but a crash-consistent snapshot of files without the matching database may not restore a coherent Nextcloud instance. Back up:
- Nextcloud configuration and application state;
- its internal data dataset;
- the database with a supported consistent method;
- custom apps and themes where applicable;
- external SMB data under its own retention policy;
- encryption keys and recovery material if encryption is enabled.
Test restoration to an isolated instance. An SMB dataset snapshot protects file content but does not recreate Nextcloud shares, users, app configuration, comments, or activity.
The right design follows ownership: TrueNAS owns datasets, snapshots, and SMB; Nextcloud owns its database-backed collaboration state; external storage is an explicit integration with known change-detection limits. Keeping those boundaries clear is more reliable than letting two systems write the same hidden data tree and repairing the index afterward.