Be aware, moving the data dir after installation is not supported and may cause issues.
Edit 2017 (as this is a popular topic):
If you have a fresh install, consider reinstalling with your preferred directory location.
Unofficially moving the data directory can be done as follows:
- Make sure no cron jobs are running
- Stop apache
- Move
/data
to the new location - Change the
config.php
entry - Edit the database: In
oc_storages
change the path on thelocal::/old-data-dir/
entry - Ensure permissions are still correct
- Restart apache
However this is not supported and you risk breaking your database. It’d be better if instead you:
- Make sure no cron jobs are running
- Stop apache
- Move
/data
to the new location - Create a symlink from the original location to the new location
- Ensure permissions are still correct
- Restart apache
(Note, you may need to configure your webserver to support symlinks)
Which is supported by Nextcloud.