How to successfully migrate Nextcloud to a new server
A Nextcloud migration typically involves transferring data from one Nextcloud server to another, or switching from other platforms, like ownCloud, to Nextcloud. The reasons behind this migration can vary, from hardware upgrades to changing hosting services.
What are the reasons for migrating Nextcloud?
Migrating to Nextcloud or changing your server can make sense or even be necessary for several reasons. Often, it’s driven by the need for better performance, enhanced security, or increased flexibility drives. Common motivations for server migration include:
-
Upgrading hardware for better performance: When the current infrastructure is stretched to its limits - due to growing user numbers or expanding data volumes - upgrading to more powerful servers results in noticeable improvements in speed and stability.
-
Switching from virtual environments to physical servers: Many migrate from virtual software solutions to physical servers for added computing power. Physical servers often deliver better performance and reliability.
-
Switching hosting provider: Another common reason is the desire to change Nextcloud hosting provider, whether this is to save costs, gain better support, or comply with stricter data protection regulations.
-
Nextcloud functionality: The open-source nature of Nextcloud offers a wide range of features and high scalability through apps. This makes it an appealing option compared to typical Nextcloud alternatives.
What are some common scenarios for migrating Nextcloud?
Several scenarios can prompt a Nextcloud migration. The most important factor, however, is where the data is stored and where it will be transferred. The most common migration scenarios are:
-
Migrating from Nextcloud to Nextcloud: This involves transferring data between two Nextcloud servers, typically to take advantage of more powerful hardware or a different hosting provider. Nextcloud’s export/import feature, which has been available since version 24, is designed for this scenario. It allows you to export data from an archive and migrate it to the new server.
-
Switching from another platform to Nextcloud: This scenario typically involves migrating from other platforms like ownCloud to Nextcloud. The switch is often made to benefit from the wide range of Nextcloud apps, a supportive community, and the software’s superior scalability. First, data is exported from the old platform, before migrating it to Nextcloud.
-
Migrating data from a local database to the cloud: In this scenario, locally stored data, apps, and digital resources are partially or fully moved to a Nextcloud environment. The extent of the migration largely depends on the reasons for the switch and the specific objectives.
With Managed Nextcloud, IONOS offers you a reliable cloud solution where you don’t need to worry about software installation or maintenance. Benefit from secure infrastructure hosted at EU server locations and receive tailored, professional support.
How to migrate Nextcloud to a new server
Migrating to a new server requires careful planning. The following guide outlines the steps for successfully transferring your data. Always create a backup of all important data before starting the migration process. This means you can easily restore your system if something goes wrong.
Step 1: Prepare the new server
-
Install the desired operating system on the new server.
-
Set up the necessary components, including the web server, PHP, and the database of your choice (MySQL, MariaDB, PostgreSQL, Oracle).
-
Make sure the PHP version and all relevant PHP extensions are compatible with your Nextcloud configuration.
Step 2: Put Nextcloud into maintenance mode
- Put Nextcloud into maintenance mode on the current server using the following command:
sudo -u www-data php occ maintenance:mode --onbash- Wait a few minutes for all sync clients to recognise the maintenance mode. Then, stop the web server running Nextcloud.
Step 3: Back up and transfer the database
-
Perform a database backup (dump) for your existing installation.
-
Transfer the database backup to the new server and import the data into the new database.
Step 4: Copy the files
-
Copy all files from your Nextcloud instance to the new server.
-
Make sure the data files retain their timestamps. Otherwise, clients will have to re-download them after the migration. Use the rsync synchronisation tool for this:
rsync -avz --progress --times /path/to/nextcloud/ /destination/path/bash-
If any file paths change during the Nextcloud migration, make sure you update the paths in the Nextcloud config.php accordingly.
-
Run this command to resolve any inconsistencies after migration:
sudo -u www-data php occ maintenance:repairbashStep 5: Check data fingerprint
-
In the
config.phpfile of the original system, check whether adata-fingerprintvalue has been set. -
If it has, run the following command on the new server:
sudo -u www-data php occ maintenance:data-fingerprintbashStep 6: Do a test run on the new server
-
Start the database, web server or application server, and the Nextcloud application.
-
Check if the maintenance mode is still active, if a log entry is created, and for any error messages.
-
Disable the maintenance mode and log in as an administrator to check that everything is working as expected.
Step 7: Update DNS Entry
Update the CNAME record in your DNS settings to redirect users to the new server location.
Apart from activating maintenance mode, avoid making any changes to the original system. If issues arise, you can revert to the old instance. Depending on the size of your instance, migrating Nextcloud may take several hours.
- Keep your data safe with industry-leading security
- Save time on updates and maintenance
- Easily add apps and online office tools
How to migrate from ownCloud to Nextcloud
Migrating from ownCloud to Nextcloud is similar to performing a manual upgrade. The versions of both cloud applications need to be compatible, so you can only migrate from ownCloud 10.13.x to Nextcloud 25.0.x (at least 25.0.13). To migrate ownCloud to Nextcloud, follow these steps:
-
Create a backup: Always make a backup before starting the migration.
-
Download the compatible Nextcloud version: Get the appropriate version of the software from the Nextcloud archive page.
-
Perform the upgrade: Follow the official Nextcloud upgrade instructions to install Nextcloud over the existing ownCloud instance.
-
Adjust the database: After the update, run these commands (after running
occ upgrade) to properly configure the database:
occ db:convert-filecache-bigint
occ db:add-missing-columns
occ db:add-missing-indices
occ db:add-missing-primary-keysbash-
Check CronJobs: If CronJobs were set up in the old configuration, make sure they are now configured via PHP command (instead of
occ system:cron), and set up as Nextcloud CronJobs. -
Upgrade to the latest Nextcloud version: Use the integrated Nextcloud updater to update to the latest version.
-
Check warnings: Look for any security or setup warnings in the ‘Overview’ section of your Nextcloud settings.
-
Check and reactivate apps: After the Nextcloud migration, some ownCloud apps might be disabled. Reinstall the Nextcloud versions of these apps with these commands:
occ app:enable calendar
occ app:enable contactsbash- Automatic backup and easy recovery
- Intuitive scheduling and management
- AI-based threat protection

