The easiest is to directly change it during setup: When choosing "advanced" setup method, you can set the directory in the setup wizard!
The following hints are currently unsupported!!! Reasons are currently discussed here: https://github.com/owncloud/documentation/pull/1588
But even if you have set up your owncloud already, and want to change your data directory, it can be achieved. The following guide applies for all Unix derivatives, for Windows it is not supported! (https://github.com/owncloud/core/issues ... t-76145839). You should have OC 8.0 or later (for previous versions, have a look on the bottom of this post).
- Stop your webserver
- Check if your config.php already contains a datadirectory entry. If it does, remember that location (let's assume it's '/var/www/owncloud/data' for now).
- Change or create the "datadirectory" entry in config.php file, so that it points to wherever you want to have your data from now on. Assuming the directory you want to move the data folder to is '/media/usbdisk/ocdata', your config.php should look like this after the change:
Code: Select all
<?php
$CONFIG = array (
'datadirectory' => '/media/usbdisk/ocdata/',
'dbtype' => ... - Make sure the "ocdata" subdirectory doesn't exist yet (or the command in the following step will move your data folder in a subdirectory of it)
- Move all the existing files of the original data (/var/www/owncloud/data in our example) to that new location, e.g. under linux:
Code: Select all
mv /var/www/owncloud/data /media/usbdisk/ocdata
- Make sure the permission/ownership of the new folder is set up correctly, and that all files contained in it have the user running php as owner (see e.g. here for Linux how to find out which user that is). Let's assume your apache runs as "www-data" (as it e.g. would under Ubuntu). Then you should change all folders/files to be owned by that user, like so:
Code: Select all
chown -R www-data:www-data /media/usbdisk/ocdata
You can verify that the webserver can read the directory, this should show you the content of the folder:Code: Select all
sudo -u www-data ls -lisa /media/usbdisk/ocdata
- Start your webserver
- Possibly (if your files don't show up) you might have to rescan your files (see e.g. here or here on how to do that)
Workarounds for Problems:
1. The PHP setting open_basedir is not allowing the access to the new datadir
2. If the datadir is placed on an external storage on linux make sure that the user running your webserver has read/write permissions to this new mountpoint. Just using the chown command doesn't help here. See "man mount" for more informations.
3. selinux is blocking the access (See this post)
4. For versions prior to 8.0, it is not officially supported (be careful! Backup!). One problem is, that there can be absolute paths in the oc_storages (to be modified after step 3).