Migrate large amounts of data to a Nextcloud

When migrating to a nextcloud, you can use rsync to migrate a large amount of data and/or files. The way of migration enables to only include the very necessary servers involved. To do the migration, I use tmux, rsync, and change ownership and insert it into the nextcloud file directory afterwards accordingly.
Start the migration by starting tmux.

tmux
Using tmux, enables to disconnect the session without interupting the migration. Then start the migration via rsync.
rsync -azP -e "ssh -p <Remote-Port>" <Remote-User>@<Remote-Host>:<Remote-Path> <Nextcloud-Path>/data/<Username>/files/<Directory-Where-To-Place>
The -azP is to archive, compress, and show progress. If the remote server listens on the standard port 22, there is no need for the ssh part.
After the data transfer is done, change the owner and add the files to the nextcloud file index.
chown www-data:www-data <Nextcloud-Path>
docker exec -u www-data <Container ID> php occ files:scan --all
Done!

Previous Blog Entry


Last update: 2025-12-28