NextcloudPi - Recovery Error

I tried to restore a backup via the GUI of NextcloudPi. I got the following error message:

[ nc-restore ] (Mon May 1 11:35:30 CEST 2023)
check free space...
extracting backup file /media/backup/ncp-backups/nextcloud-bkp_20230501_1682930752.tar.gz...
restore files...
DATA CONFLICT! Your old '/var/www/nextcloud/data' directory can be found in '/var/www/nextcloud/.data_2023-05-01' after the restore script is done. The new '/var/www/nextcloud/data' directory will be restored from the backup. You can manually merge these directories with this command (run nc-fix-permissions and nc-scan afterwards): cp -rn '/var/www/nextcloud/.data_2023-05-01/'* '/var/www/nextcloud/.data_2023-05-01/'.[!.]* '/var/www/nextcloud/data/'
Restoring old '/var/www/nextcloud/data' to '/var/www/nextcloud/.data_2023-05-01'...
restore database...
backing up existing /media/myCloudDrive/ncdata/data to /media/myCloudDrive/ncdata/data-2023-05-01...
mv: cannot move '/media/myCloudDrive/ncdata/data' to '/media/myCloudDrive/ncdata/data-2023-05-01/data': Directory not empty
Cleanup...

What is the cause?

Kind regards,
Michael

Looks like you tried to restore a backup on the same day and the restore script uses only the date for temporary directories, which causes a conflict in your case.

To fix your issue, you coud rename the offending directory (e. g. sudo mv /media/myCloudDrive/ncdata/data-2023-05-01/media/myCloudDrive/ncdata/data-2023-05-01-tmp) or wait until tomorrow before running the script again.

I’ll adjust the restore script to use the current time instead of just the date for intermediate directory names, to avoid such issues in the future

1 Like

Thank you for the quick reply. Ok, I thought here besides the date- also the timestamp is considered. Normally it does not happen that backup and restore take place on the same day. But in the future it would be good if the timestamp is also used.
I will check it tomorrow.

Have made the update to Nextcloudpi version 1.52.0.
2023-05-14_fix-ncp-restore

And then started a restore from yesterday’s backup. The error still exists: DATA CONFLICT

[ nc-restore ] (Sun May 14 11:32:27 CEST 2023)
check free space...
extracting backup file /media/backup/ncp-backups/nextcloud-bkp_20230513_1683939604.tar.gz...
restore files...
DATA CONFLICT! Your old '/var/www/nextcloud/data' directory can be found in '/var/www/nextcloud/.data_2023-05-14T1684056898' after the restore script is done. The new '/var/www/nextcloud/data' directory will be restored from the backup. You can manually merge these directories with this command (run nc-fix-permissions and nc-scan afterwards): cp -rn '/var/www/nextcloud/.data_2023-05-14T1684056898/'* '/var/www/nextcloud/.data_2023-05-14T1684056898/'.[!.]* '/var/www/nextcloud/data/'
Restoring old '/var/www/nextcloud/data' to '/var/www/nextcloud/.data_2023-05-14T1684056898'...
restore database...
backing up existing /media/myCloudDrive/ncdata/data to /media/myCloudDrive/ncdata/data-2023-05-14T1684056933...
restore datadir to /media/myCloudDrive/ncdata/data...
Create subvolume '/media/myCloudDrive/ncdata/data'
Maintenance mode disabled
Installing template 'php/opcache.ini.sh'...
System config value tempdirectory set to string /media/myCloudDrive/ncdata/data/tmp
System config value logfile set to string /media/myCloudDrive/ncdata/data/nextcloud.log
System config value trusted_domains => 11 set to string ***
System config value trusted_domains => 1 set to string ***
System config value trusted_domains => 14 set to string nextcloudpi
System config value trusted_domains => 3 set to string ***
System config value overwrite.cli.url set to string ***
System config value trusted_proxies => 11 set to string ***
System config value trusted_proxies => 12 set to string ::1
System config value trusted_proxies => 13 set to string ***
System config value trusted_proxies => 14 set to string ***
Setup notify_push (attempt 1/5)
✓ redis is configured
✓ push server is receiving redis messages
✓ push server can load mount info from database
✓ push server can connect to the Nextcloud server
✓ push server is a trusted proxy
✓ push server is running the same version as the app
configuration saved
Scanning AppData for files

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 3408 | 3900 | 00:00:19 |
+---------+-------+--------------+
Cleanup...

Is there another problem?