Backup and Restore Advice


I just installed NextCloud 15 on my raspberry pi and everything is working great so far. The last piece of the puzzle is getting good backup of nextcloud so if anything ever happened to the hardware, I can get back up and running as fast as I can. I have a bash script that makes an image of the SD card with ‘dd’ and it works fine. I do know that restoring from an image can corrupt a sql db pretty quick.

My question: Is there anything I can add to the script to make sure the image is good and I don’t have to worry about MySQL corruption? Or is the dd image going to work?

Does anyone have some advice/experience with backups and restores of NextCloud?

Any help to point me in the right direction would be greatly appreciated. Thanks.

Update: I found a backup script that backups up SQL by putting nextcloud into maintenance mode. Figured I can do the same thing while making an image. Any thoughts?

Put nextcloud into maintenance mode before the image is made and then turn it off after the image is done.

The image takes about 30 minutes. Good or Bad idea?

and dump your mysql db. (or shutdown it down.)

maybe you find some hints here.

Thanks. I decided to just shut it down after maintenance mode is enabled and start it up before maintenance mode is turned off.

Thanks again.