In short
Block storage or NFS is the more robust choice for most instances: files sit readable on a file system and tools like occ files:scan work. S3 as primary storage pays off for large data volumes and several application servers, but it requires that database and bucket are always backed up together.
| Criterion | S3 Object Storage | NFS / Block Storage |
|---|---|---|
| How files are stored | Objects urn:oid:<fileid>, no folder structure or file names | Plain files and folders in the data directory |
| Role of the database | The only mapping from objects to paths and names | Metadata cache, files stay readable without the DB |
| Scaling | Capacity grows without rebuilds, multiple app servers are easy | Block storage tied to one server, NFS possible for several |
| Performance | Higher latency per request, good for large files | Low latency on block storage, NFS sensitive to many small files |
occ files:scan | Not usable, files are not on a file system | Works, e.g. after manual changes |
| Backup | DB dump and bucket must match the same point in time | File system or volume snapshot plus DB dump |
| Switching later | No official migration tool between storage types | No official migration tool between storage types |
| Typical problems | Lifecycle rules, multipart uploads, access keys | NFS locking, permissions and UID mapping, mount missing after reboot |
Pick S3 Object Storage if …
- you expect many terabytes and capacity should grow without a move.
- several Nextcloud application servers will run behind a load balancer.
- you already run or buy a reliable, redundant S3 service.
- your backup can capture database and bucket consistently together.
Pick NFS / Block Storage if …
- you run a single instance with a manageable amount of data.
- files should be readable without Nextcloud in an emergency.
- you want tools like
occ files:scan, rsync or file system snapshots. - the team is more at home with file systems than with object storage.
Pitfalls from operations
- Lifecycle or expiry rules on the S3 bucket delete objects Nextcloud still references. Files then show up in the UI but can no longer be downloaded.
- Database lost, bucket intact: without the DB the objects are just numbered blobs. A tested DB backup is mandatory with S3.
- NFS: Nextcloud starts before the mount is up and writes into the empty local directory. Add a mount dependency in systemd.
- NFS: different UIDs for the web server user on client and server cause permission errors. Align UID/GID on all systems.
FAQ
Can I use S3 as external storage instead of primary storage?
Yes. As external storage the folder structure is kept in the bucket and you can use S3 for selected folders only. That is often the lower-risk way to start.
Can the primary storage be switched later?
Only with significant effort, using unofficial scripts or a fresh install with data import. Make the decision before going live.