Accessing data after rebuilt

I had to rebuilt my NextCloudPi on my raspberryPi4, I have ncdata on SSD.
I’m trying to find a way to re-link users to their files, is that possible?

First read Backup and Restore. For NextCloudPi it maybe differ.

Nextcloud uses files (including program files (e.g. php) and configs) and a database (e.g. MariaDB). Normally you backup all and you can restore all.

Have you got a backup from your database or only from your files? Do you have a backup?

I’ve had HDD for backups but I was having issues trying to restore from it, it appears that when it tries to extract the compressed backup it fails, not sure if that’s because I’ve got around 70Gs of data or because the HDD is faulty.

Now I still have the same ncdata from the previous build and trying to access it or link to it, I’ve made the process of moving data of the new build to the same location in the SSD and created the same user that used to own the data but still unable to view files from the old build, I’m sure its a sql permissions but not sure where to start.

Without database restore:

You can create all users, copy the files in the correct folders (of the user dirs) and then:

sudo -u www-data /path/to/nextcloud/occ files:scan --all

Sorry. But only files. You will lose all your shares, too.

my data directory is /mnt/usb/ncdata/data , will that change the command?

If you execute the command Nextcloud scans the data directory (set in config/config.php) and updates the known files. Nextcloud knows the files in the directories only because of the database entries.