Nextcloud-snap: Move data location to external drive .ocdata error

Created on 20 Dec 2017  路  21Comments  路  Source: nextcloud/nextcloud-snap

Hello I have been trying to research this all day and I keep getting the same error "your data directory is invalid Ensure there is a file called ".ocdata" in the root of the data directory.

Thanks!

Most helpful comment

make sure the mount point is also owned by root (/media/mymountingpoint), mine was owned by my current user, changed to root and everything was working again

All 21 comments

Explain to me exactly what you're trying to do. You had the snap working without any external drive, and now you want to migrate all that date to the external drive?

sorry if it sounded confusing. What I want to do is to be able to default all of my Nextcloud files on to an external drive instead of the internal drive on my Ubuntu machine. This previous ticket helped a lot but its still not working for me https://github.com/nextcloud/nextcloud-snap/issues/150#issuecomment-267641192. I have moved and changed the data directory to the /media/externaldrive and then I get this error. "your data directory is invalid ensure there is a file called ".ocdata" in the root of the data directory."
Thanks and sorry I'm new to this stuff.

Okay much more clear, thank you :) .

Can I see the output of ls -ld /media/externaldrive, please?

The data file is in the right place so I checked the data folder and the drive for the data file i got ls: cannot access '/media/woodriver/2godd/data' : permission denied and for the external drive I got drwx------ 4 root root 4096 dec 20 14:41
nextcloud

Alright, use sudo in front of those commands to ensure you don't get permission denied. I'd like to see that as well.

I should have known to do that sorry. for the data folder I got -rw-r--r--r 1 root root 0 Dec 20 11:21 /media/woodriver/2godd/data
img_0942

Alright, one more level: sudo ls -la /media/woodriver/2godd/data let's see if that file is in there...

Weird the .ocdata is in there.
img_0943

Wait... that's showing 2godd1 as owned by woodriver. But an earlier snippet showed that directory was owned by root. What gives?

You're switching things around... 2godd, 2godd1... I can't help you if I'm not getting consistent information!

Sorry I did notice that too. I do have the data directory set as the 2godd1. I'm not sure why my external drive is showing up with 3 different names. I formatted it before I started using it.
img_0945

img_0944

I'm facing similar issue after following directions here:
https://github.com/nextcloud/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition

Steps taken (as root):
- mounted new external hd as /mnt/external
- changed datadirectory in /var/snap/nextcloud/current/nextcloud/config/autoconfig.php
- ran snap disable nextcloud
- went to look at /mnt/external, saw a couple of files, if I remember correctly, one of which was .ocdata
- didn't bother with it and went on
- continued to the end of the instructions

Could it be that snap disable nextcloud should be run before changing the datadirectory in config.php?

Ok I ran touch .ocdata and when signing to web ui through lan ip I was greeted with this

`Access through untrusted domain

Please contact your administrator. If you are an administrator, edit the "trusted_domains" setting in config/config.php like the example in config.sample.php.

Further information how to configure this can be found in the documentation.`

From wan the site could not be found.

nextcloud.occ config:system:get trusted_domains returns right domains...

Ok now after a moment access though domain works fine, from local ip I still get "Access through untrusted domain"

I had the same issue when following the instructions from https://github.com/nextcloud/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition
Solved it by running sudo chown -R root:root /mnt/nextcloud meaning one folder above the data folder

Thanks slomo-official for the suggestion! Unfortunately that did not help in my case.

@slomo-official Thanks for mentioning! @kyrofa I ran into the same issue! Would you mind updating the wiki article? If the data directory is in /media/my/new/data, root must also own the directory /media/my/new to make this work:

$ sudo chown -R root:root /media/my/new

I had the same issue when following the instructions from https://github.com/nextcloud/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition
Solved it by running sudo chown -R root:root /mnt/nextcloud meaning one folder above the data folder

make sure the mount point is also owned by root (/media/mymountingpoint), mine was owned by my current user, changed to root and everything was working again

make sure the mount point is also owned by root (/media/mymountingpoint), mine was owned by my current user, changed to root and everything was working again

Thank you for this suggestion! It didn't work for me however it led me to change the owner to www-data and it is working now

I have installed Ubuntu 20.04 with Snap.

When I follow the steps from this wiki article
https://github.com/nextcloud/nextcloud-snap/wiki/Change-data-directory-to-use-another-disk-partition

the file autoconfig.php is reverted back to its recent version after a couple of seconds, and the config doesn't come into effect.

I ran into this same error message, after following the aforementioned instructions in the wiki to the letter, also using the Nextcloud Snap on Ubuntu.

It turns out there was a symlink in my data directory path in config.php. Apparently Nextcloud did not appreciate that. I used the full path instead and that resolved the issue.

@71ae the instructions state to edit config.php, not autoconfig.php.

Was this page helpful?
0 / 5 - 0 ratings