nextcloudpi
nextcloudpi copied to clipboard
Data folder deleted after restoring from data-less backup
I just had massive problems restoring my ncp docker instance after some files got corrupted (due to worn-out SD-card!?)
I make data-less ncp backups every 2nd day and use my own rsync script to backup the data folder. The corrupted files were not part of the data folder! My expectation was to reinstanciate my docker container, mount the same data volume as before, run the ncp-restore and have a happy day.
BUT: After running the ncp-restore with my data-less archive, I realized all the data was gone. The problem seems to be these 2 lines in the nc-restore script: https://github.com/nextcloud/nextcloudpi/blob/dd8fc3dd7d663faf5d916039ee042ef049aaf728/bin/ncp/BACKUPS/nc-restore.sh#L66-L67 Here, the nextcloud folder gets deleted and replaced by the one from the backup. What seems to be good for a backup WITH data can lead to a nightmare in case of a data-less backup. Luckily, I had my own backup of the data folder!!
To fix this, I ran the script step by step and replaced the lines with an rsync command.
That is what I have discovered a month ago. Just wanted to restore the "dataless" Backup and all my Data was gone after that.
But luckily I had an external backup.
That is to be expected. Bear in mind that the php code for Nextcloud is also in the volume together with the data. In the non-docker case, if we have moved the data, then it will honor that but that is a quirk. If you restore a dataless backup in the general case you end up with a clean instance, with the exception I mentioned before
@nachoparker
Thank you for clarification! Indeed I am using the Docker-Version of Nextcloudpi. Again thank you for clarification and have a nice day! :)
Now it happened! I lost my data by restoring a data-less backup!! @nachoparker can you please please find a better solution. In case a data-less restore is issued, the data folder should not be touched. Please reopen!!
Reopen please!
I'll have another look at this
Thank you! This severe issue made me switch to nextcloud/docker :cry:
+1 Bumping this
- -[ ] A way to restore a backup recursively, like with rsync or something similar and not just replace the nextcloud directory as is when restoring the backup tar.
+1 Bumping this, a note for when I have the time, or if theCalcaholic looks at it before me
- A stop from restoring a backup and deleting existing files or perhaps a second temporaary file with the current files as a backup, just in case. Unless of course I'm too tired right now and missed it already being there
I have drafted a fix for this: https://github.com/nextcloud/nextcloudpi/pull/1601
It's still untested and can be improved
The change is now included in version v1.50.5