I have installed nextcloud on Windows PC using Ubuntu. Data is stored on external drive. I want to be able to disconnect and reconnect the external drive. When I reconnect I run into access error -
"Your data directory is invalid.
Ensure there is a file called ".ocdata" in the root of the data directory.
Cannot create "data" directory.
This can usually be fixed by giving the web server write access to the root directory.
See https://docs.nextcloud.com/server/27/go.php?to=admin-dir_permissions"
Since the data folder is not accessible so there is no error log to analyze either. After reading through various posts on this issue I tried the following but error message is not going away.
sudo chmod -R 0770 /mnt/n/nextcloud/data
sudo chown -R www-data:www-data /mnt/n/nextcloud/data
Also tried
sudo chown -R www-data:www-data /mnt/n/nextcloud
sudo find /mnt/n/nextcloud/ -type d -exec chmod 750 {} \;
sudo find /mnt/n/nextcloud/ -type f -exec chmod 640 {} \;
datadirectory is β/mnt/n/nextcloud/dataβ.