September 7, 20214 yr Hi guys! I've been crawling the internet and not been able to find anything clear. Currently I want to have a backup unraid server in case of hardware failure. So I want to go from server A to server B. I have nextcloud running and I would like to backup the whole nextcloud (docker container, MariaDB and Nextcloud Share). I was thinking to run a backup on server A and recover it on server B. then to copy the whole Nextcloud share. I don't know if it is that simple, but at leasts shows you what I am trying to achieve. Have any of you guys done this? I mean If you have a couple of users relying on nextcloud and if it breaks, what would happen? Thanks a lot.
September 7, 20214 yr Can’t you set up Nextcloud itself to handle syncing of data between the two servers? Getting the actual container settings is quite easy, so you want a simple solution to keeping the data synced.
September 8, 20214 yr Author I didn't know that was even possible, but if you write a tutorial of how to do it I will make another showing how to do it the way I did it. Do we have a deal?
September 8, 20214 yr 11 hours ago, rojarrolla said: I didn't know that was even possible, but if you write a tutorial of how to do it I will make another showing how to do it the way I did it. Do we have a deal? I haven’t done it which was why it was a question rather than a suggestion. I am relatively certain that it is possible though.
September 12, 20214 yr Author OK, No, I haven't, I will try to look into it, and if I find how, I will post the 2 options and mark this thread as solved. Should you know before me, please let us know in this thread. Thanks!
June 23, 20242 yr Old thread, but seeing as I've just figured out how to do this for myself I'm posting in case it's useful for anyone else. Basically Nextcloud doesn't give you an easy to use backup solution, however I've read that the NextCloud-AIO instance does. I just have regular NextCloud. According to the documentation here, it says that you should copy the installation and the database, and later use these to restore. My use case is to copy and encrypt that data to cloud storage, in my case DropBox. The basic steps are: 1. Get rclone installed on your Unraid instance 2. Configure rclone for your chosen cloud provider (in my case, DropBox) and set up the remote rclone destination 3. [Optional] Use rclone to encrypt your remote cloud destination 4. Install the "User Scripts" plugin in Unraid in case you don't already have it 5. Use my script below with your appropriate modifications as a "User Script". 6. Run the copy script manually for the first time (it will take a long time depending on your NC install size, network etc.) 7. Once your initial copy is done, enable scheduler (I've set my to daily) using "User Scripts" in unraid. 8. That's it! Note that I haven't tried a restore, and I'm not too fussed about it because I know I can get my data in the worst case scenario. I'm not too bothered about the rest of my NC install. #!/bin/bash # Script to backup NextCloud installation to DropBox # v1.0 22nd June 2024 - Initial # Check if previous run worked, abort otherwise echo Checking for existing lock file ... if [ -f /tmp/nc_backup.lock ] ; then /usr/local/emhttp/webGui/scripts/notify -e "NextCloudBackup" -s "NC Daily Backup" -d "Finished" -i "ERROR" -m "The NexCloud backup script FAILED" echo ERROR: Lock file exists, likely that a previous run failed. Aborting! exit 1 fi # Create lock file while the script works echo Creating new lock file ... touch /tmp/nc_backup.lock # Perform the backup while in maintenance mode echo Putting NextCloud in maintenance mode ... docker exec nextcloud occ maintenance:mode --on # dump the database echo Dumping the database ... docker exec mariadb mysqldump --single-transaction -u mydatabasename -mypassword nextcloud > /tmp/nextcloud-sqlbkp_`date +"%Y%m%d"`.bak # copy the database echo Deleting any existing database files from the remote cloud storage ... rclone delete NextCloudBackupEncrypted:daily_db echo Copying the dumped database ... rclone copy /tmp/nextcloud-sqlbkp_`date +"%Y%m%d"`.bak NextCloudBackupEncrypted:daily_db/ echo Cleaning up dumped database ... rm /tmp/nextcloud-sqlbkp_`date +"%Y%m%d"`.bak # sync all other files echo Syncing NextCloud installation ... rclone sync --transfers 12 --tpslimit 12 /mnt/user/nextcloud/ NextCloudBackupEncrypted:daily/ echo Turning off maintenance mode ... docker exec nextcloud occ maintenance:mode --off # Remove the lock when all done echo Removing lock file for next run ... rm /tmp/nc_backup.lock # Finished /usr/local/emhttp/webGui/scripts/notify -e "NextCloudBackup" -s "NC Daily Backup" -d "Finished" -i "normal" -m "The NextCloud backup script SUCCEEDED" exit 0 Edited June 23, 20242 yr by DANgerous25 cleaned up unnecessary commands
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.