Hello,
I’m coming to you because I have a question and I’d like to be sure that I don’t miss any step during my migration to avoid losing my users’ data.
I currently have a server that has had disk problems. To do this, I’ve made a full backup of user data /data as well as all Nextcloud configuration.
Here are the migration steps I’m in the middle of and I’d like to know if everything is correct.
- Put the nextcloud to be killed into maintenance and wait 30 minutes.
- Backup the database
- Backup user data /data except the contents of the /preview of appdata (yes I don’t need the preview and it takes up space)
- Backup nextcloud config
----- COMPLETE SERVER REINSTALLATION => DONE ---- - Install nextcloud dockers on server
- Once installation is complete, open nextcloud to run the quick setup phase and check that it’s running.
- Put nextcloud in maintenance mode
---- START RESTORATION PHASE DATA USERS + CONFIG - Re-copy backup user data to /data folder
- Modify nextcloud config files to match old config (instance id, hash, salt, …)
----- START OF DB RESTORE PHASE ---- - Delete nextcloud table => docker exec -it nextcloud-db-1 /bin/bash => mysql -u nextcloud -p -e “DROP DATABASE nextcloud
- Re-create the nextcloud table => docker exec -it nextcloud-db-1 /bin/bash => mysql -u nextcloud -p -e “CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci””.
- copy the DB backup to the db instance => docker cp ./database.dmp nextcloud-db-1:/dmp
- Import DB backup on db instance => docker exec -it nextcloud-db-1 /bin/bash => mysql -u nextcloud -p nextcloud < /dmp
- delete DB instance backup => docker-compose exec db rm /dmp
- make the client take priority over the server (so if the server is outdated, clients will point to the server) => docker compose exec --user www-data app php occ maintenance:data-fingerprint
- fix preview folder => docker compose exec --user www-data app php occ files:scan-app-data
- Restore nextcloud operation by removing maintenance mode
- Restore the online site to the same address so that customers can reconnect.
Is everything OK with you? I’ve already had the surprise of my client deleting all the content I had and re-downloading it from the server, so I’ve lost some data. I’d like to avoid this problem. Will point 14 avoid the problem?
Concerning point 15, is it worth doing it because I have a /preview folder that is now empty, whereas before it was full?
I’ve heard of the “files:cleanup” and “files:scan” commands. Should I run them or not?
Many thanks for your help.