Moving "data" folder to a new location (external HDD)

Nextcloud version : 12
Operating system and version : Raspbian Stretch
PHP version : 7

Original data folder was at /var/nextcloud/data (everything work fine). The i move data folder to a new location (external hdd, ext4 partition),

sudo mv /var/nextcloud/data media/pi/disk1/nextcloud/data
sudo ln -s media/pi/disk1/nextcloud/data /var/nextcloud/data

there is an error:

ls -ld /media/pi/disk1/nextcloud/data
ls: cannot access '/media/pi/disk1/nextcloud/data': Permission denied

As result, there is an error at web-interface with access to data folder.

Permissions set to folder, owner and group, as for original location are www-data 750

there was no modification to config.php file:

  'datadirectory' => '/var/nextcloud/data',

After trying numerous solution to the similar problem, i still can’t have right access permission.
Am I missing something?
Thank you.

Please check the parent folders as well, www-data needs to be able to read and execute within them. It should be ok once you can see a file listing entering this command:

sudo -u www-data ls -lisa /media/pi/disk1/nextcloud/data

Thank you! After i set www-data as owner and group to /pi/ directory, everything work fine.

setting the owner to all the HDD is a bit too much maybe I let the drive for root and only the data folder to www-data, and it work (for now). Is there any future possible trouble with this configuration?

There is no problem about that in general. Only that the path to the data folder must be readable for the www-data user. So this should work:
sudo -u www-data ls -lisa /path/to/data-folder

Ok. Now I have problems. I took the external hard drive mounted (after shuting down my raspbian) and pass files from another one (ntfs) with my laptop. After pluging back and turn on the filesystem turns to readonly. I connected the drive in the same usb port. I’m guessing that I broke the files permissions?

So, after very frustrating attempts the main conclusion that I have is that the new raspberry can handle high power consumption of an external drive by itself. It’s needed an external powered drive.

hello all,

i am having the same problem as mentioned here how can i resolve it. I absolutely new to Linux so please forgive me if i as several times about the same thing.

When i navigate to the webpage i get a bank white screen on Firefox.