Is it safe to remove old entries in
oc_storage table that refer to old, unused local storages? I seem to still have an old storage back from owncloud, and very old one from nextlcoud (changed mountpoints years back).
Is it safe to remove old entries in
Should work fine, did this on my machine as well some time ago. However do a
mysqldump first, just to be sure.
I followed solution 2 and it works fine. But, subsequently I’ve tried to install ElasticSearch full text search in my NC accordingly to this manual. But this ends up not in a working full text search but in:
pi@raspberrypi:~ $ sudo service elasticsearch start
pi@raspberrypi:~ $ sudo service elasticsearch status
● elasticsearch.service – LSB: Starts elasticsearch
Loaded: loaded (/etc/init.d/elasticsearch; generated; vendor preset: enabled)
Active: active (exited) since Wed 2019-04-24 13:07:26 BST; 40s ago
Process: 556 ExecStart=/etc/init.d/elasticsearch start (code=exited, status=0/SUCCESS)
Apr 24 13:07:26 raspberrypi systemd: Starting LSB: Starts elasticsearch…
Apr 24 13:07:26 raspberrypi systemd: Started LSB: Starts elasticsearch.
pi@raspberrypi:~ $ sudo -u www-data php /home/pi/usbdrive/html/occ fulltextsearch:index
In Index.php line 380:
failed platform test.
fulltextsearch:index [–output [OUTPUT]] [-r|–no-readline] [–] 
What am I wrong?
Please verify if
elasticsearch follows symlinks by default or not. Just a guess in the blue, since this is the basic change that comes with solution 2 .
Hi, in the next days I will need to add a new disk to my server and with this will change my filesystem. After this my nextcloud_data folder (only this since the nextcloud system files are on a different drive) will have a new path. I read that changing the path is not recommended. Since all files in my nextcloud instance are synced to clients and I don’t need the previous version etc. I wonder if there is a way to reset (empty) the nextcloud data folder without the need to reinstall nextcloud? Meaning that for all users the folder is empty and filled with the data from the clients at the first sync. Similar to the first sync after a new installation.
You don’t run it on DietPi, do you? In case moving the
nextcloud_data inside can be done without any changes to Nextcloud.
However otherwise changing/moving your Nextcloud data dir via solution 1 (of this HowTo) requires an adjustment of the database in every case, with or without clearing the data. In fact clearing the data just means additional steps and risk. So no benefit/point in doing this IMO, only the risk that clients pull file removals instead of pushing them to server.
Whatever you do, do a full backup of your Nextcloud install dir and database. And
rsync the data (preserving timestamps) instead of moving them, so you have a backup in case any issue, corruption I/O error or such happens. And block/disconnect the server from clients access until you verified (e.g. accessing to web UI locally) that everything went well, before re-opening for client access.
Isn’t it a better solution to mount the new storage in your nextcloud folder directly?
nextcloud/data as one mount and
/nextcloud/data/appdata_oc56k88881p0f/preview as another. Works great and it makes it easier to backup nc and user data.
The whole idea of having it outside the Nextcloud install dir is the security aspect to have it outside of the webserver document root. And the effort for moving/backing up is nearly the same. I mean if you copy/sync one or two directories does not really make a difference, does not?
But generally moving data by mounting it to the old location is actually a “solution 3” as alternative to the symlink method. However I personally prefer to have the least amount of links/mounts/redirects possible to keep things simple and avoid unexpected surprises and such. So I always go with “solution 1” and tell Nextcloud directly where the final location is, in case of a mount inside
/mnt. But that’s as well about personal taste and needs.
Ok, thanks. Then I will try solution 1. A backup of my data is available. Worst case means at the end reinstall nextcloud on the server.
How can I check afterwards that everything went fine. Is it sufficient to simple open some files in the WebUI or is there any better check/test?
If you can see your files and can write to them (or create new ones) then this should be sufficient as check.
A reinstall should never be required as long as you have your e.g. /var/www/nextcloud (or where you installed it) and the database dump (as mentioned/created through the HowTos steps) you can always revert to the previous stage. PHP, webserver, Redis server (in case you use it) and all this are not affected.
Thank you very much for this thread! Very helpful
After all the answers, I am a little bit lost regarding the actual operations to be done to move data directory (as there have been updates since, some of the commands are no longer required).
I have a “Tech and Me” Nextcloud VM. I understand that, even if Solution 1 is a little bit more risky, it’s the one you recommend (mainly for security reasons). Then, can I use Solution 1, described in the first post for the “Tech and Me” Nextcloud VM? or should I change / add / avoid some commands?
Thank you so much again!
Just found this article: https://www.pandatech.co/2018/05/increase-nextcloud-13-storage-extend-zfs/
If you are looking to add some more space on data directory on your Nextcloud “Tech and Me” VM, why not just add a new disk on the ZFS pool?
Jep exactly, the official VM already has the data dir located on a separate ZFS partition, thus there is really no need to change anything about this and it might even break the VM UI elements.
If required, one could either raise the drives size + ZFS partition or add a new drive to the ZFS pool as you mentioned. However AFAIK there is usually no need to make things more complicated with a second data drive, the VM platform should allow to increase the size of existing drives, if required? At least on VirtualBox and VMware this works quite well.
I added the hint to the initial post besides Snap/Docker/NCP appliances hint, many thanks for reporting! .
Please keep in mind after move your data folder - Files amount after moving of data directory is wrong (much bigger).
But also note that when following Solution 1, the doubled entry is avoided by this step:
update oc_storages set id='local::/new/path/to/data/' where id='local::/path/to/data/';
But aside from that obviously, having a look into this database table generally makes sense from time to time, when heavily changing data dir and/or external storages.
hey I have try your tutorial but i have some probleme. First I don’t find the occ folder in my server second when i enter the first command the console display “php:comand not found”
(I have install nextcloud on the ubuntu server setup)
occ is not a folder, but a file, located in the root of your Nextcloud install dir, e.g.
Is the error message from
php that it does not find the
occ command, or is the
php command itself not found (which seems to be the case based on error message)?
which php if it gives any output. Assure that you have php-cli installed (which ships the command).
Which OS do you use? Sometimes the command is shipped with PHP version string inside, e.g.
php7.3. It should be located in
/usr/local/bin/ depending on your install method. Or you run some system-wise search:
find / -type f,l -name php