Import old files into new installation

Hey everyone,

Because of a kernel update that went horribly wrong, I’ve had to reinstall my machine. However, my old files were kept on an external harddrive, so they’re still intact.

Is there some way to import these files into the new installation without having to download them and then reupload them?

Thanks!

Mount your external harddrive into your system.

1. First easy way with use of external harddrive:

Then add it under admin settings as external harddrive. There can you set which user/group can get access to the harddrive.
You can´t use your harddrive now anymore. It´s in your system now!

2. Second way with Copy to special user:
Copy your files and directories to the user data folder.
Use command

cp -aR /mountdirectory_of_external_hdd/files/* /var/www/nextcloud/data/USERNAME OF NEXTCLOUD/files/

or different commands like:

rsync -avr /mountdirectoy_of_external_hdd/files/* /var/www/nextcloud/data/USERNAME OF NEXTCLOUD/files/

After that you need to fix the file permissions:

cd /var/www/
(sudo) chown -R www-data:www-data nextcloud
(sudo) find nextcloud/ -type d -exec chmod 750 {} ;
(sudo) find nextcloud/ -type f -exec chmod 640 {} ;

https://docs.nextcloud.com/server/13/admin_manual/maintenance/manual_upgrade.html (Step 9)
With this step you can umount and format your external hdd. It´s free now and you can use it for other usecases.

In both cases / ways might be a

sudo -u www-data php (/var/www/nextcloud)/occ files:scan --all or --unscanned

useful. See:
https://docs.nextcloud.com/server/13/admin_manual/configuration_server/occ_command.html#file-operations