[Solved]Owncloud doesn't found .ocdata file after have change the drive

I just realize there is also a “.htaccess” missing file…

let’s try again

cp -p -r /mnt/ownclouddrive/{.,}* /mnt/temp

this is the output:

root@DietPi:~# cp -p -r /mnt/ownclouddrive/{.,}* /mnt/temp
cp: will not create hard link '/mnt/temp/ownclouddrive' to directory '/mnt/temp/.'
cp: cannot copy a directory, '/mnt/ownclouddrive/..', into itself, '/mnt/temp'
root@DietPi:~#

I tried anyway to restart all the services and connect through the browser and something change:
now the owncloud page tells me: Your Data directory is not writable by ownCloud
Is it something due to permissions, but where? in the database?

can you share the content of the drive used for owncloud now?

Here it is

root@DietPi:~# ls -la /mnt/ownclouddrive
total 364
drwxr-xr-x 11 root     root       4096 Dec 14 16:52 .
drwxr-xr-x  7 root     root       4096 Dec 15 10:44 ..
-rw-r--r--  1 www-data www-data    323 Dec  7 22:21 .htaccess
-rw-r--r--  1 www-data www-data      0 Dec  7 22:21 .ocdata
drwxr-xr-x  5 www-data www-data   4096 Dec  8 20:35 admin
drwxr-xr-x  2 www-data www-data   4096 Dec  7 22:25 avatars
drwxrwxr-x  9 dietpi   dietpi     4096 Dec  6 17:23 dietpi_userdata
drwxr-xr-x  2 www-data www-data   4096 Dec  7 22:30 files_external
drwxrwxr-x  2 dietpi   dietpi     4096 Aug  8 12:23 ftp_client
-rw-r--r--  1 www-data www-data      0 Dec  7 22:21 index.html
drwxrwxr-x  2 www-data www-data  16384 Dec  7 20:27 lost+found
drwxrwxr-x  2 dietpi   dietpi     4096 Aug  8 12:24 nfs_client
-rw-r-----  1 www-data www-data 311130 Dec 15 11:15 owncloud.log
drwxrwxr-x  2 dietpi   dietpi     4096 Aug  8 12:24 samba
drwxrwx---  4 www-data www-data   4096 Dec 15 10:41 temp

hmm there are way more folders as before. did you copied something in addition? Looks like you copied the content of the entire /mnt/ directory? can you share ls -la /mnt/. Is this the old or the new drive?

root@DietPi:~# ls -la /mnt/
total 28
drwxr-xr-x  7 root   root   4096 Dec 15 15:53 .
drwxr-xr-x 18 root   root   4096 Dec 13 16:18 ..
drwxrwxr-x  9 dietpi dietpi 4096 Dec  6 17:23 dietpi_userdata
drwxrwxr-x  2 dietpi dietpi 4096 Aug  8 12:23 ftp_client
drwxrwxr-x  2 dietpi dietpi 4096 Aug  8 12:24 nfs_client
drwxr-xr-x 11 root   root   4096 Dec 14 16:52 ownclouddrive
drwxrwxr-x  2 dietpi dietpi 4096 Aug  8 12:24 samba

This was the new drive… should I re-format it before coping the file from the old one?

Since I had nothing to lose I tried to format again the new drive and repeated the steps suggested before.
The result is still the same:

Your Data directory is not writable by ownCloud
The permissions can be usually changed <a href="https://doc.owncloud.com/server/10.8/go.php?to=admin-dir_permissions" target="_blank" rel="noreferrer">giving to web server writable access to the root folder</a>.

can you share following

cat /var/www/owncloud/config/config.php | grep datadirectory
root@DietPi:~# cat /var/www/owncloud/config/config.php | grep datadirectory
  'datadirectory' => '/mnt/ownclouddrive',

this is the output

ok do this

chown www-data:www-data /mnt/ownclouddrive/

This should allow web server access to data directory

Hi again,
I think is going to work now.
I’m not sure just because I’m trying to access using my DDNS domain and now, instead of before, it shows me:

“You are trying to access the server from a non trusted domain.
Contact your system admin. If you are an admin, configure the setting “trusted_domains” in config/config.php.
An example configuration is provided in config/config.sample.php or in the documentation.”

I think when I’ll be back in my network it will work. or it should :blush:.

I guess once I will have solved also the DHCP on my server maybe this setting will be useless. What do you think?

have a look into /var/www/owncloud/config/config.php. There is a section trusted_domains where you can add your DDNS as an additional line

  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '192.168.x.x',
    2 => 'DietPi4',
  ),

I have inserted my domain in the trusted and now it is working

perfect :slight_smile:

I just see that in this file I have:

'trusted_domains' =>
  array (
    0 => 'dietpi IP',
    1 => 'my router public IP',
    2 => 'my DDNS domain',
  ),

the router public IP, I think, changes every time the router goes off. Isn’t it?
Could it be the reason why I can’t reach the server using my DDNS domain when I’m in my network?

(see the topic https://dietpi.com/forum/t/solved-how-to-connect-outside-of-dietpi-network/6041/1)

Usually it should be the local IP instead of your public one

so the right configuration should be:

'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'dietpi static IP',
    2 => 'my DDNS domain',
  ),

Is this correct?

you are not limited to these 3 lines, you could easily add a 4t or 5th one if needed. However Owncloud should tell you that a domain is not trusted as it already did :slight_smile:

Thanks again for your help. I guess if someone has the same problem could follow the thread from the beginning and come out easily.