Move nextcloud folder problems

Hi,

I installed nextcloud on raspberry pi. Everything works fine, but I can’t move the data folder.

I attached an external HDD to the raspberry pi and mount it when booting. Everytime I replace the data folder I get an internal server error (also updated the config.php). I think this is a permissions problem. In the nextcloud folder I’m able to use
sudo chown -R www-data:www-data /var/www/html/nextcloud/
to set the right permissions.
On the HDD this does’t work (no permission to do this).

I tried different formatting formats (ext4, ntfs, fat32), but nothing seems to work.

The only thing I can think about to ‘avoid’ this problem is booting from the USB drive. But I don’t think that’s the ‘clean’ solution.

Hope someone can help me!

Kind regards,

Matthias