Restore files without database (across NC versions)

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

    • Nextcloud Server version (e.g., 29.x.x): Nextcloud Hub 26 Winter (33.0.0)

    • Operating system and version (e.g., Ubuntu 24.04): Debian 13/ Docker

    • Web server and version (e.g, Apache 2.4.25): nginx/1.29.4

    • Reverse proxy and version _(e.g. nginx 1.27.2): nginx/1.29.4

    • PHP version (e.g, 8.3): PHP 8.4.19

    • Is this the first time you’ve seen this error? (Yes / No): Yes

    • When did this problem seem to first start? First call

    • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)

      • Docker on private server
    • Are you using CloudfIare, mod_security, or similar? (Yes / No) No

Summary of the issue you are facing:

Following a deadly crash with a previous instance running NC v25, I had to fully recreate a new platform based on NC v33. I recreated by script all user accounts, copied all data back and tried to rescan all files to link them back to their owners.

I didn’t restore the database as it has been created for v25 and the server is now running v33: am I right?

Here’s the script I used for the files:

echo “Restoring user files…”
docker exec --user www-data -it nextcloud2-app php occ maintenance:mode --on
docker cp --follow-link /home/Backup/backup-NC1/ nextcloud2-app:/var/www/html/data

echo “Changing file permissions…”
docker exec nextcloud2-app chown -R 33:0 /var/www/html/data
docker exec nextcloud2-app chmod -R 750 /var/www/html/data

echo “Reindexing user files…”
docker exec --user www-data -it nextcloud2-app php occ files:scan-app-data
docker exec --user www-data -it nextcloud2-app php occ files:scan --all

echo “Synchronizing with clients…”
docker exec --user www-data -it nextcloud2-app php occ maintenance:data-fingerprint

echo “Adding missing database indexes…”
docker exec --user www-data -it nextcloud2-app php occ db:add-missing-indices

echo “Fixing MIME types…”
docker exec --user www-data -it nextcloud2-app php occ maintenance:repair --include-expensive
docker exec --user www-data -it nextcloud2-app php occ maintenance:mode --off

Can’t be more straightforward…

However, users don’t see any files when connecting to their new account, letting me wondering if I used the proper procedure to restore these.

Should I try to restore the database? Is there any other procedure to restore files only?

Thanks in advance for any help!

More details: the application container defines a volume /home/nextcloud/data:/var/www/html/data. When I copy all backup data into the container (docker cp --follow-link /home/Backup/backup-NC1/ nextcloud2-app:/var/www/html/data), I’m expecting /home/nextcloud/data to mirror the /var/www/html/data content.

However, once the copy is done, /home/nextcloud/data displays the account folders correctly (i.e. /home/nextcloud/data/user1) but these folders do not display the backup files I’ve just copied!

Can anyone please explain the correct procedure?

Thanks in advance for any help!