How to change default Data folder


OS: Debain 8.7
Owncloud: ownCloud 9.0.9 (stable)

I want to change the default data folder, but not able to understand exact correct way.
The default is /var/www/owcloud/data. I have mounted usb drive on /media/Test/data.

I have followed link
Method One
1. Method Stop Apache
2. Use rsync to sync the files from the current folder to the new one
3. Create a symbolic link from the new directory to the old one
4. Double-check the directory permissions on the new directory
5. Restart Apach
The below command is not working in Debian
rsync -avz /var/www/owncloud/data /mnt/owncloud
Method Two
Fix Hardcoded Database Path Variables
If you want to manually change the location of the data folder in the database, run the SQL below:
UPDATE oc_storages SET id='local::/mnt/owncloud' WHERE id='local::/var/www/owncloud/data'
The other area to check is the oc_jobs table. The logrotate process may have hard-coded a non-standard (or old) value for the data path. To check it, run the SQL below and see if any results are returned:
SELECT * FROM oc_jobs WHERE class = 'OC\Log\Rotate';
As soosn as above query is run it gives error as
ERROR 1046 (3D000): No database selected

I am not hardcore system admin guy so facing challenge in understanding exact which guide will help to change default data location.


First hit on google [1] gives quite a lot information of this. You need to switch to the ownCloud database before you can use these commands.