Replacing data directory

Hi,

I folllowed the steps here to move the data directory: https://doc.owncloud.com/server/admin_manual/maintenance/manually-moving-data-folders.html

Using this

UPDATE oc_storages
SET id='local::/mnt/owncloud/data/'
WHERE id='local::/var/www/owncloud/data/';

Gives following error
afbeelding

All the other steps worked without errors. Everything seems to work and it looks like data is transferred to to right location.

Someone who knows what the problem is here?

Can you run the following select?

SELECT * FROM oc_storages WHERE id='local::/var/www/html/owncloud/data/';
1 Like

Can you also run:

SELECT * FROM oc_storages WHERE id='local::/mnt/owncloud/data/';

So ID is the primary key of the table(?), and I would guess somehow that there is already an entry with the new path. So potentially you could just delete that row? Perhaps @jvillafanez can chime in?

1 Like

Anyone an idea? I just want to be sure it’s safe to use it like this.

OK, so. I re-read the instructions, and I guess you’ve added the datadir directory in your config.php before you started doing these steps, so ownCloud already created that entry in oc_storages. Can you confirm that?

As far as I can tell there are no other references oc_storages. Can you run the following, just to be sure:

select table_name
from information_schema.KEY_COLUMN_USAGE
where table_schema = 'owncloud'
and referenced_table_name = 'oc_storages';

If you get Empty set (0.00 sec) as a reply you should be good to delete that column (with the old data folder in it).

1 Like

This is indeed the case. The outcome of the commands:
afbeelding

Is this the correct command to remove the row?

DELETE FROM oc_storages WHERE id='local::/var/www/html/owncloud/data/';

Thank you very much!

The delete looks correct to me. It might be overkill for this simple delete, but I use the following process for this:

BEGIN; #start a transaction
SELECT * FROM oc_storages WHERE id='local::/var/www/html/owncloud/data/'; # check the row you want to delete
DELETE FROM oc_storages WHERE id='local::/var/www/html/owncloud/data/'; # run the actual delete
SELECT * FROM oc_storages WHERE id='local::/var/www/html/owncloud/data/'; # check that you deleted what you wanted to delete
COMMIT; # finish transaction, run ROLLBACK(); if you didn't delete the right thing
1 Like

Thank you very much!

1 Like