Updated juli 25, 2026
Summary: A proper Nextcloud backup must include the database, configuration files, and encryption keys alongside file data. Skipping any of these components makes a restore incomplete or impossible.

A Nextcloud backup is a consistent, restorable copy of all components that make the platform functional: the file data directory, the relational database, the configuration files, and any encryption key material. Organizations running Nextcloud for collaboration, document storage, or regulated data workflows depend on all four of these components working together. Losing any one of them can make a restore impossible even if the others are intact.

Why a File Copy Is Not Enough

The most common mistake in Nextcloud backup planning is treating the platform like a simple file server and copying only the data directory.

Nextcloud stores the relationship between files and users, sharing permissions, file versions, calendar events, contacts, and application state in a relational database, typically MySQL, MariaDB, or PostgreSQL. The data directory contains the raw files, but without the database those files have no context. You cannot determine who owns them, which are shared, or which version is current.

As the Nextcloud Administration Manual states: “A backup that does not include the database is not a Nextcloud backup. It is a pile of files with no context.” This is not a stylistic point. During an actual restore, a database-less backup produces a non-functional instance that requires manual reconstruction of metadata, which is often impractical at scale.

Note: If your Nextcloud instance uses server-side encryption, the encryption master key or per-user key material must be backed up separately. Files restored without their corresponding keys are permanently unreadable, regardless of how complete the rest of the backup is.

What a Complete Nextcloud Backup Must Include

A complete backup requires four distinct components, each with its own backup method and considerations.

Component Location Backup method Notes
Data directory Configured in config.php (datadirectory) File-level copy or snapshot Can be large; incremental preferred
Database MySQL/MariaDB/PostgreSQL mysqldump, pg_dump, or hot backup tool Must be consistent with data directory
Configuration file config/config.php File copy Contains instance secret and database credentials
Encryption keys data/files_encryption/ File copy, stored separately and securely Loss makes encrypted files permanently inaccessible

Before starting any backup, Nextcloud should be placed in maintenance mode using the occ maintenance:mode --on command. This prevents concurrent writes to the database and file system during the snapshot window, ensuring both components remain consistent with each other.

See how Qsentinel solves this in practice.Start a 10-user pilot →

Restore: The Part Most Organizations Skip Testing

A backup has no proven value until it has been restored successfully in a controlled environment. This is not a theoretical concern. According to the Veeam Data Protection Trends Report 2023, 68% of organizations experienced at least one data loss event in the prior year. The IBM Cost of a Data Breach Report 2023 puts the average global cost of a breach at USD 4.45 million, with encrypted environments taking an average of 287 days to identify and contain.

For Nextcloud specifically, the restore sequence must follow a defined order: restore the database first, then restore the data directory, then place the configuration file back, and finally run occ maintenance:data-fingerprint to update the sync state so connected clients recognize the restored instance as authoritative.

Article 32 of the GDPR requires that organizations processing personal data implement measures ensuring “the ability to restore the availability and access to personal data in a timely manner after a physical or technical incident.” This makes a documented, tested restore runbook a legal requirement for any Nextcloud instance handling personal data of EU residents, not a best-practice suggestion.

Compliance note: A backup that has never been tested in a restore scenario does not satisfy the GDPR Article 32 requirement for demonstrable restorability. Data Protection Officers should verify that restore tests are scheduled and documented.

Automated Backups and Restore in a Managed Context

Self-managed Nextcloud deployments place the full burden of backup scheduling, monitoring, off-site replication, and restore testing on the internal IT team. This is achievable but requires dedicated processes, tooling, and periodic verification.

Managed platforms such as Qsentinel, which delivers Nextcloud Enterprise with Swiss or on-premise hosting, handle backup orchestration as part of the service layer. This typically means automated daily snapshots that cover all four required components simultaneously, off-site replication to a geographically separate facility, and defined recovery time objectives documented in the service agreement. For organizations subject to data sovereignty requirements, the backup destination jurisdiction matters as much as the backup itself: a backup replicated to a US-based data center may fall under the CLOUD Act regardless of where the primary instance runs.

Disaster Recovery Is Broader Than Backup

Disaster recovery for Nextcloud encompasses the backup strategy but extends further: it includes the recovery time objective (how quickly the service must be restored), the recovery point objective (how much data loss is acceptable), tested failover procedures, and documented communication protocols for when an incident occurs.

Organizations that rely on Nextcloud for daily operations, particularly those processing sensitive data under frameworks like the NIS2 Directive or ISO 27001, should maintain a written disaster recovery plan that references specific backup schedules, retention periods, restore procedures, and the names of personnel responsible for executing them. Generic references to “having a backup” are insufficient for audit purposes under these frameworks.

FAQ

Can I just copy the Nextcloud data directory to create a backup?

No. Copying the data directory alone produces an incomplete backup. Without the database, Nextcloud cannot reconstruct file ownership, sharing permissions, versioning metadata, or calendar and contact records. The database and configuration files are equally essential.

Do I need to put Nextcloud in maintenance mode before backing up?

Yes, for a consistent backup you should enable maintenance mode before starting. This prevents new writes to the database and data directory while the snapshot is taken, avoiding inconsistencies between the two components.

What happens to encrypted files if the encryption key is not backed up?

If server-side encryption is enabled and the master key or per-user key material is lost, the files become permanently unreadable even if the files themselves are present. Key material must be backed up separately and stored securely.

How does GDPR affect Nextcloud backup requirements?

Article 32 of the GDPR requires that organizations implement measures ensuring the ability to restore access to personal data in a timely manner after an incident. This makes a tested, documented restore process a legal obligation, not just good practice.

What is the difference between a backup and disaster recovery for Nextcloud?

A backup is a copy of data at a point in time. Disaster recovery is a broader plan that includes the backup but also defines recovery time objectives, failover procedures, alternative infrastructure, and tested restore runbooks. A backup without a tested recovery plan does not constitute disaster recovery.

Hoe Qsentinel dit oplost

Qsentinel is the managed Nextcloud Enterprise workspace, enhanced by Qsentinel with post-quantum encryption and sovereign private AI, hosted in Switzerland or on-premise, out of reach of the CLOUD Act.

Start a 10-user pilot

Frequently asked questions

Can I just copy the Nextcloud data directory to create a backup?
No. Copying the data directory alone produces an incomplete backup. Without the database, Nextcloud cannot reconstruct file ownership, sharing permissions, versioning metadata, or calendar and contact records. The database and configuration files are equally essential.
Do I need to put Nextcloud in maintenance mode before backing up?
Yes, for a consistent backup you should enable maintenance mode before starting. This prevents new writes to the database and data directory while the snapshot is taken, avoiding inconsistencies between the two components.
What happens to encrypted files if the encryption key is not backed up?
If server-side encryption is enabled and the master key or per-user key material is lost, the files become permanently unreadable even if the files themselves are present. Key material must be backed up separately and stored securely.
How does GDPR affect Nextcloud backup requirements?
Article 32 of the GDPR requires that organizations implement measures ensuring the ability to restore access to personal data in a timely manner after an incident. This makes a tested, documented restore process a legal obligation, not just good practice.
What is the difference between a backup and disaster recovery for Nextcloud?
A backup is a copy of data at a point in time. Disaster recovery is a broader plan that includes the backup but also defines recovery time objectives, failover procedures, alternative infrastructure, and tested restore runbooks. A backup without a tested recovery plan does not constitute disaster recovery.