[SOLVED] 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!

Surprising… Has no one ever tried to restore only files?

Reminder of the context: a v25 instance crashed and the only solution was to create a fresh v33 instance. I can’t restore the database (lost in the crash), user files is the only thing I have at hand.

Thanks in advance for any help!

Please HELP! :folded_hands:

How many Users we are talking about you need to restore its data and files?

More then a hundred users… I’ve already recreated all user accounts (as said, previous databse is lost) and need to restore their files now.

Couple thoughts:

  • Anything unusual about the permissions/ownership of the source path/files?
  • Any chance you’re using an ancient Docker Engine version?
  • Since you’re not using Docker volumes and all folders are located on your underlying host, you don’t have to use docker cp.
  • Perhaps post your Compose file if still stuck
  1. Nothing I’ve noticed so far, I’ll check again.
  2. No: all components are updated in due time.
  3. Right, this was the initial command before I switched to local path…
  4. Here’s the compose file:
version: '3.8'

services:
  # Base de données
  db:
    image: mariadb:latest
    container_name: "nextcloud2-hub-mariadb"
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    restart: always
    volumes:
      - /home/nextcloud/database:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=mysqlroorpassword
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=mysqluser
      - MYSQL_PASSWORD=mysqlpassword
    networks:
      - backend

  # Cache Redis (pour booster les performances)
  redis:
    image: redis:alpine
    container_name: "nextcloud2-hub-redis"
    restart: always
    networks:
      - backend

  # OnlyOffice Document Server
  onlyoffice:
    image: onlyoffice/documentserver:latest
    container_name: "nextcloud2-hub-onlyoffice"
    restart: always
    ports:
      - 8089:80
    environment:
      - JWT_ENABLED=true
      - JWT_SECRET=jwtsecret
    volumes:
      - /home/onlyoffice/data:/var/www/onlyoffice/Data
      - /home/onlyoffice/log:/var/log/onlyoffice
    networks:
      - backend

  # Antivirus ClamAV
  clamav:
    image: clamav/clamav:stable
    container_name: "nextcloud2-hub-clamav"
    restart: always
    # Le conteneur mettra un peu de temps à démarrer (mise à jour des signatures)
    volumes:
      - /home/clamav/virusdb:/var/lib/clamav/
      - /var/run/clamav/:/var/run/clamav/
    networks:
      - backend

  # Nextcloud HPB
  spreedbackend:
    image: ghcr.io/nextcloud-releases/aio-talk:latest
    container_name: "nextcloud2-hub-talk"
    init: true
    ports:
      - 3478:3478/tcp
      - 3478:3478/udp
      - 8181:8081/tcp
    environment:
      - NC_DOMAIN=nc.mydomain.com
      - TALK_HOST=nc.mydomain.com
      - TURN_SECRET=turnsecret
      - SIGNALING_SECRET=siganlingsecret
      - INTERNAL_SECRET=internalsecret
      - TZ=Europe/Brussels
      - TALK_PORT=3478
    restart: unless-stopped   
    networks:
      - frontend
      - backend
    
  # Serveur de fichiers Nextcloud
  app:
    image: nextcloud:latest
    container_name: "nextcloud2-hub-app"
    restart: always
    ports:
      - 8088:80
    depends_on:
      - db
      - redis
    volumes:
      - /home/nextcloud/html:/var/www/html
      - /home/nextcloud/data:/var/www/html/data
      - /home/clamav/virusdb:/var/lib/clamav/
      - /var/run/clamav/:/var/run/clamav/
    environment:
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nc-user
      - MYSQL_PASSWORD=mysqlpassword
      - MYSQL_HOST=db
      - REDIS_HOST=redis
    networks:
      - frontend
      - backend

# Définition des volumes
volumes:
  nextcloud_data:
  nextcloud_db:
  onlyoffice_data:
  onlyoffice_log:

# Définition des réseaux
networks:
  frontend:
    driver: bridge
  backend:
    driver: bridge

Hope this helps!

Thanks a lot for your help!

Hi all,

I finally rebuilt the service from scratch (tried Nextcloud AIO but was blocked by the 100 accounts max, back to standard Nextcloud + OnlyOffice + Turn stack), scripted the accounts creation using a CSV file I saved from the previous platform, cleaned and filtered all backup files, then imported manually the most important account and rescanned the whole stuff.

The platform is now up and running, with good performances and stability.

The thread is now closed and I just want to send a warm 'thank you" to all who provided some help along the way! :folded_hands: