How to Back Up Nextcloud and Avoid Restore Problems

Fairooza

Desktop Interface
8 min read|15.06.2026

In most Nextcloud environments, files are lost because of everyday problems such as accidental deletion, failed updates, database corruption, storage failures, or misconfigured backups. Many administrators assume their data is safe until they need to recover it. A reliable backup strategy requires more than simply copying files.

A complete Nextcloud backup includes not only user files but also the database, configuration files, and other critical components. Missing any one of them can make a successful recovery much more difficult.

In this guide, we explain what needs to be backed up, explore the most common Nextcloud backup methods, walk through the restore process, and share practical best practices that help keep your data recoverable when you need it most.

Why backups are critical for every Nextcloud deployment

Data loss can happen even in a well-maintained Nextcloud environment. A storage failure may suddenly make files inaccessible, while a simple user mistake can result in important documents being deleted. Software updates can occasionally introduce issues that affect system stability, and database corruption can leave files present on disk but unavailable through Nextcloud. Security incidents such as ransomware add another layer of risk because encrypted files can quickly spread across synchronized devices.

Many users assume that synchronizing files across devices provides sufficient protection. Synchronization keeps data consistent between locations, but it also replicates unwanted changes. If a file is deleted or corrupted, that change can be synchronized as well. A backup provides a recoverable copy of your data from an earlier point in time.

Understanding what to back up and how to restore it is essential for protecting a Nextcloud deployment.

What Needs to Be Backed Up in Nextcloud?

A successful Nextcloud recovery depends on more than restoring user files. According to the official Nextcloud documentation, a complete backup consists of five components: the data folder, database, configuration folder, custom apps, and themes. Each component stores information that Nextcloud needs to function correctly.

The data folder contains the actual files uploaded by users, while the database stores the metadata, user accounts, sharing permissions, and settings that make those files usable in Nextcloud. Without the database, the files may still exist, but Nextcloud cannot properly rebuild the environment they belong to.

The configuration folder contains critical settings such as database connection details, trusted domains, instance identifiers, and security-related parameters. Custom apps and themes should also be included in the backup because they may contain functionality, settings, or user interface customizations that are not part of a standard Nextcloud installation.

Missing any of these components can make recovery incomplete. Files without the database can lead to missing metadata and broken shares, while a database without the corresponding files can contain records that point to missing content. Missing configuration files can also prevent the restored instance from functioning correctly. For a complete recovery, Nextcloud requires the database, data directory, and configuration files.

For this reason, a Nextcloud backup should always be treated as a backup of the entire environment, not just a copy of user files.

How to Back Up Nextcloud

A reliable Nextcloud backup is not just a copy of your files. A successful backup captures the database, files, and configuration in a consistent state so they can be restored together when needed.

Step 1: Put Nextcloud in Maintenance Mode

Before starting a backup, enable maintenance mode. This temporarily prevents users from making changes while the backup is running. Without maintenance mode, files and database records can change during the backup process, creating inconsistencies that may cause problems during recovery.

To run the following command, navigate to your Nextcloud installation directory. In most deployments, this is usually located at /var/www/nextcloud/.

  sudo -E -u www-data php occ maintenance:mode --on

Step 2: Back Up the Database

The database contains user accounts, file metadata, sharing permissions, application settings, calendars, contacts, and other information that allows Nextcloud to function correctly. Backing up files without the database can leave you with data that cannot be fully restored.

For MariaDB or MySQL deployments:

mysqldump --single-transaction -u username -p database_name > nextcloud.sql

For PostgreSQL deployments:

pg_dump -U username -d database_name > nextcloud.sql

Step 3: Back Up the Data Directory

The data directory contains the files stored by users and application data generated by Nextcloud. For most deployments, it is the largest component of the backup. A complete backup should include the entire data directory so that user files can be restored alongside the database and configuration files.

The location of the data directory is defined in the Nextcloud configuration. In many installations, it is located at /var/www/nextcloud/data, but administrators should verify the configured path before creating a backup.

Step 4: Back Up Configuration Files

Back up the configuration folder, particularly the config.php file, along with any custom applications or themes that are required by the deployment. Configuration files contain important settings such as database connections, instance information, and security-related configuration. If these files are missing, rebuilding the original environment can take significantly longer.

Step 5: Verify the Backup

A completed backup job does not automatically mean the backup is usable. Verification helps confirm that backup files were created successfully and can be restored when needed.

Step 6: Store a Copy Offsite

Keeping backups on the same server protects against some failures but not all of them. Hardware faults, ransomware incidents, and site-wide outages can affect both production data and local backups. Storing a copy in a separate location provides an additional layer of protection and supports long-term recovery planning.

Backup Methods Available for Nextcloud

There is no single backup strategy that suits every Nextcloud deployment. Most organizations combine multiple methods to balance recovery speed, storage requirements, and operational effort.

Manual Backups

Manual backups involve backing up the data directory, configuration files, custom applications, themes, and the database. This approach works with MariaDB, MySQL, PostgreSQL, and SQLite deployments. It provides full control over how backups are created and stored, but backup scheduling, monitoring, retention, and recovery testing remain the administrator's responsibility.

Nextcloud AIO Built-In Borg Backups

Nextcloud All-in-One includes built-in Borg backups that support incremental backups, compression, deduplication, and encryption. Borg can back up the files, database, and configuration required for recovery. Administrators must still manage backup repositories, protect encryption keys, and regularly test restores.

Snapshot-Based Backups

Technologies such as VM snapshots, Proxmox snapshots, and ZFS snapshots capture a system's state at a specific point in time. Snapshots are useful for quickly rolling back failed updates or configuration changes, but they should complement traditional backups rather than replace them.

Offsite Backups

Offsite backups store data in a separate location, such as S3-compatible storage, a secondary server, a NAS device, or another cloud platform. This protects against hardware failures, ransomware, and site-wide outages. Many organizations follow the 3-2-1 backup rule: three copies of data, two storage types, and one offsite copy.

For organizations that prefer not to manage backup infrastructure themselves, managed Nextcloud hosting providers can handle backup monitoring, infrastructure maintenance, and recovery planning as part of the service.

Try managed Nextcloud now

How to Restore a Nextcloud Backup

Restoring a Nextcloud backup involves more than recovering user files. A successful recovery requires the files, database, and configuration to be restored as a complete system. If any of these components are missing, the restored environment may not function correctly.

Before You Begin

Before starting the restore process, make sure you have:

  • A backup of the data directory
  • A database backup
  • Configuration files, including config.php
  • Any custom applications or themes used by the deployment

According to Nextcloud's documentation, the database, data directory, and configuration files are all required for a complete restoration.

Restoring Files

Start by restoring the data directory and configuration files from the backup. If the deployment includes custom applications or themes, restore those as well. The restored files, database, and configuration should all originate from the same backup point to avoid inconsistencies after recovery.

Restoring the Database

Once the files have been restored, restore the database used by the deployment, whether it is PostgreSQL, MariaDB, or MySQL. The database contains user accounts, file metadata, sharing permissions, application settings, calendars, contacts, and other information required for Nextcloud to operate correctly.

Post-Restore Tasks

After the restore is complete, verify that the instance is functioning as expected. Important checks include:

  • Confirming users can access their accounts
  • Verifying shared files and folders
  • Checking calendars and contacts
  • Testing installed applications
  • Running a file scan if required to synchronize the file system with the database

If the restored backup is older than the data available on connected clients, Nextcloud also recommends updating the data fingerprint and performing a file scan to help synchronize recovered data correctly.

A backup should not be considered successful until the restored environment has been tested and verified.

Common Nextcloud Backup and Restore Problems

Even a complete backup can fail if it is not created, stored, or restored correctly. Many recovery problems occur because one component of the backup is missing or because the backup has never been tested.

Some of the most common issues include:

  • Incomplete database backups that prevent a successful restore.
  • Missing backup components such as configuration files or application data.
  • Borg repository issues caused by incorrect repository paths or unavailable storage locations.
  • File and database mismatches that can result in missing files, broken shares, or inconsistent metadata.

Many of these issues can be avoided by enabling maintenance mode before backups, verifying that all required components are included, storing backups in a reliable location, and regularly testing restore procedures. After a restore, running a file scan and validating user access can help identify any remaining inconsistencies before the system returns to production.

Best Practices for Business-Critical Nextcloud Deployments

Use Maintenance Mode During Backups: Maintenance mode helps ensure that files and database records remain consistent while a backup is being created. Without it, users may continue making changes during the backup process, which can lead to mismatches between the database and the data directory. For environments where data integrity is important, creating backups from a consistent state reduces the risk of recovery issues later.

Encrypt Backup Archives: Backups often contain the same sensitive information stored in the production environment. If backup archives are lost, stolen, or accessed by unauthorized users, the data remains exposed. Encrypting backup repositories and archives helps protect business documents, user information, and other confidential data during storage and transfer.

Maintain Multiple Backup Generations: Keeping a single backup is rarely enough. Problems such as ransomware, accidental deletion, or data corruption may go unnoticed. Maintaining multiple recovery points allows administrators to restore data from a point in time before the issue occurred.

Regularly Test Recovery Procedures: A backup is only valuable if it can be restored successfully. Regular recovery testing helps verify that backup files are complete, the restore process is documented, and recovery objectives can be met when needed. Testing restores periodically provides confidence that recovery will work when it matters most.

How CloudBased Backup Helps Simplify Nextcloud Backup Management

Building a reliable backup strategy requires more than scheduling backup jobs. Administrators must ensure backups remain consistent, monitor storage usage, test recovery procedures, maintain the underlying infrastructure, and keep systems updated over time.

CloudBased Backup reduces much of this operational overhead through fully managed Nextcloud hosting. Infrastructure maintenance, operating system updates, security patching, and platform management are handled by our team, allowing organizations to focus on their users and data rather than server administration.

Our managed environment is designed to support reliable backup and recovery workflows while providing the full Nextcloud experience. Services are hosted in European data centers with a strong focus on data privacy and GDPR compliance.

For organizations that want the benefits of Nextcloud without the complexity of managing the underlying infrastructure, a managed approach can significantly reduce the time and effort required to maintain a secure and resilient deployment.

Secure and privacy-first managed Nextcloud hosted in Germany.

Our Blog

Cloud Insights: Trends, Tips & Technologies

Nextcloud vs. pCloud - Which Cloud Storage is Better?
6 min read|12.06.2026

Nextcloud vs. pCloud - Which Cloud Storage is Better?

Cloud storage solutions are no longer limited to simply storing files online. Many now offer features for file synchronization, sharing, collaboration, and data management, making it important to choose a platform that aligns with your needs. Nextcloud and pCloud are two popular options, but they take different approaches to delivering cloud storage services. In this article, we compare Nextcloud and pCloud across key areas, including privacy, security, file management, user experience, collabo

Best ShareFile Alternatives
14 min read|11.06.2026

Best ShareFile Alternatives

Organizations use ShareFile for secure file sharing, client collaboration, and document management, but it is not always the right fit for every business. Some companies need greater control over data storage, others want stronger privacy protections, lower costs, deeper integrations, or self-hosted deployment options. Several capable alternatives are available, each with distinct strengths and trade-offs.  In this guide, we will compare the best ShareFile alternatives and highlight where each

Secure File Sharing with Clients: Best Options for Businesses
8 min read|09.06.2026

Secure File Sharing with Clients: Best Options for Businesses

Sharing files with clients has never been easier. A document can be sent in seconds through email, cloud storage, or a shared link. But as businesses handle more sensitive information, convenience alone is no longer enough. Many organizations eventually run into the same challenges. Links get forwarded beyond the intended recipient, files remain accessible long after a project ends, and it becomes difficult to track who has viewed or downloaded important documents. What starts as a simple way t

Get in Touch with Our Cloud Experts

Chat with us
Chat

Chat with us

Our friendly team is here to help

Cbb logo
Secure real-time Cloud collaboration from Europe
CloudBased Backup empowers you with Managed Nextcloud, a secure, on-premise collaboration platform offering real-time document editing, seamless video chat, and groupware across mobile, desktop, and web.
Visit us on social media.
Subscribe to our newsletter.
Get exclusive offers and always stay up-to-date.
© 2026 CloudBased Backup. All rights reserved.