If I encrypt the data directory, is this something I should even be concerned about? There will be personal data stored here that needs to be protected such as tax returns and insurance policies.
Iâm not sure about encryption. Iâve only tested it with the encryption module turned off. Does the new location of the data directory still have the same permissions/ownership that your old directory had? I apologize if I lead you incorrectly. I was not aware there were database changes required.
I am a little confused here. Iâve changed the data directory multiple times without editing the database, and everything continues to work. For testing, the data directory location changes went like this,
1: Log out of Nextcloudâs web interface.
2: Move the folder to the new location.
3: Edit config/config.php and adjust the data directory path
4: Run ./occ files:scan --all
5: Log back into the web interface.
My oc_storage table looks like this,
For reference, this is Nextcloud 10. The config.php version says, âversionâ => â9.1.0.16â. Would you mind clarifying the oc_storage changes? I donât want to be giving people bad advice.
Well basically the ./occ files:scan --all fixes the storage problem. But it also breaks shares, tags, comments, ⌠etc.
Adjusting the local::/.... id entry in storages should allow you to change the path, without breaking all the other info.
Thank you. That does clarify things. So, if you wanted to do this, the steps would be,
0: Back everything up first.
1: Disable access to Nextcloud. (maintenance mode)
2: Move the data folder.
3: Edit the database table oc_storage. Change the local::/path/to/data to local::/new/path/to/data.
4: Edit the config.php datadirectory line to reflect the new path.
5: Turn off maintenance mode.
I get the impression this is not supported, but it should work?
Iâm checking the right server, am I missing something? Sorry for my lack of experience, I may just end up having to reinstall Nextcloud. Hope not, though, itâs working.
Thatâs odd. If Nextcloud is working, there has to be a database. Check your config/config.php file for the database type, location, and credentials. It looks something like this,
/var/www/nextcloud/config/config.php doesnât even specify a database name. I know itâs working though because I added maintenance mode, switched it to âtrueâ, and the site properly locked me out.
<?php
$CONFIG = array (
'instanceid' => 'zzzzzzz',
'passwordsalt' => 'zzzzzzzzzz',
'secret' => 'zzzzzzzzzzzzzzzzzz',
'trusted_domains' =>
array (
0 => 'xxx.xxx.xxx.xxx',
1 => 'share.mydomain.com',
),
'datadirectory' => '/var/www/nextcloud/data/',
'overwrite.cli.url' => 'http://xxx.xxx.xxx.xxx/nextcloud',
'dbtype' => 'sqlite3',
'version' => '9.1.0.16',
'logtimezone' => 'UTC',
'installed' => true,
'mail_smtpmode' => 'smtp',
'mail_from_address' => 'user',
'mail_domain' => 'mydomain.com',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => 'mail.mydomain.com',
'mail_smtpsecure' => 'tls',
'mail_smtpname' => 'user@mydomain.com',
'mail_smtppassword' => 'mypassword',
'mail_smtpport' => '25',
"maintenance" => false,
);
I also did a SHOW DATABASES and received exactly the same as what phpmyadmin was showing:
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
+--------------------+
4 rows in set (0.00 sec)
But Nextcloud is honestly working just fine. This seems crazy. ANY ideas on what might be happening?
Itâs using sqlite instead of Mysql/MariaDB. I think the database will be located in your $data directory and will be a file ending with .db. Iâm not entirely sure, as Iâve never configured sqlite before.
At that point my Nextcloud database was accessible through phpmyadmin. Then I followed grouchysysadminâs steps above:
0: Back everything up first.
1: Disable access to Nextcloud. (maintenance mode)
2: Move the data folder.
3: Edit the database table oc_storage. Change the local::/path/to/data to local::/new/path/to/data.
4: Edit the config.php datadirectory line to reflect the new path.
5: Turn off maintenance mode.
In my case, I move the data directory to /etc/nextclouddata/nextcoud/data. When trying to load my login page for the first time, I got the following error:
Data directory (/etc/nextclouddata/nextcloud/data/) is invalid. Please check that the data directory contains a file â.ocdataâ in its root.
If you do not have PHPmyAdmin running on your webmin, you can always manage the database under servers->mysql database-> select your db->manage db->select oc_storages in edit db->click view data->select the row with the local:: and edit->set the new value and save.
So Iâve been struggling with moving my data directory, as well, in NC v11. My vm test went well, then a trial run on real host to tinker with; and finally, a working, live installâŚand then I realized I didnât give enough room for data storageâŚI have a 2TB external drive.
I have made several attempts, but ran into all the same issues you have with permissionsâŚany idea if this will work in v11?
(This instance is very young: it could be wiped and reinstalled, pointing to the new storage, but Iâd like to figure out how to move the data manuallyâŚat some point in the future, somebody is going to have to upgrade their storage⌠might as well find out how).
When moving the data folder to an external drive, make sure you used the correct user to mount the driveâŚ
(Even format as the user depending on the filesystem.)