Dear Big Bear, I need your help with NextCloud

Dear Big Bear
First, I would like to thank you for the wonderful information you provide to us by providing unique content on YouTube
Secondly, I hope you can help me with my problem in setting up a home server
But I would like to say that it is my first time dealing with Linux, and therefore I am a beginner, so I will explain to you in detail.
The problem is as follows
I installed it on an old computer with Debian 12, then Casa OS
Then I followed the steps you explained to install install-nextcloud-and-mysql-on-casa-os.
But I faced a problem: the hard disk on the computer was small and not enough for my files
So I added another hard drive with all my files
I made a mount for this hard drive, and the location and name of the hard drive became as follows
/mnt/sh-hard2

And my files are inside it in a folder whose name and location are
/mnt/sh-hard2/nextcloud
In order to add these files
I modified the nextcloud settings within Casa OS as in the picture

But I encounter this error message when I try to run NextCloud
As in the picture

Sorry for the length, but since I know nothing about the home server or the Linux system, I wanted to explain to you in detail.
thank you my friend

@sherif_bakr

Thank you for the detailed post.

You could of mounted the hard drive in /DATA/AppData and not had to change the paths.

Change permissions to 0770: Use the chmod command to change the permissions of the data directory to 0770. Replace path/to/your/data/directory with the actual path to your Nextcloud data directory:

chmod 0770 /path/to/your/data/directory

Verify the changes: You can verify that the permissions have been successfully changed by running the following command:

ls -ld /path/to/your/data/directory

You should see the permissions set to 0770, and it should look something like this:

drwxrwx--- 3 user user 4096 Dec  5 12:34 /path/to/your/data/directory

The Host side should be:

/mnt/sh-hard2/nextcloud/config

/mnt/sh-hard2/nextcloud/data

Don’t combine config and data.

My friend, Big Bear
Thank you very much for your interest and response to my question
I did what you told me, but a new problem appeared, which is this message

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 webserver write access to the root directory

… …
After searching on Google, I found that the problem is
Data Folder permission
I compared the powers of the data folder with the original one that works
Among the ones that NextCloud created after I changed the volume
As shown in the picture

The one above is the one that does not work and it is clear that the permissions are for root
As for the folder that works, it has all the permissions for my account and not for the root
I tried to modify the permissions a lot through
sudo chown -R sh-server:sh-server /mnt/hard-disk2/nextcloud/data
But this does not want to change
can you help me

Can you create an empty file named .ocdata in the data directory?

yes i can do that

Restart the container and see if there is another error or it is working.

another error

Have you tried?

sudo chmod -R 0770 /DATA/AppData/nextcloud/data

I’ve already done that