Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

how to move data directory, new page #1588

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions admin_manual/configuration_server/index.rst
Expand Up @@ -17,6 +17,7 @@ ownCloud Server Configuration
knowledgebase_configuration
language_configuration
logging_configuration
moving_data_directory
harden_server
performance_tuning
reverse_proxy_configuration
Expand Down
45 changes: 45 additions & 0 deletions admin_manual/configuration_server/moving_data_directory.rst
@@ -0,0 +1,45 @@
===================================
Moving Your ownCloud Data Directory
===================================

There are several reasons to move your ownCloud data directory on an existing
installation: to move it outside of your Web root for better security,
re-configuring your storage, restoring from backups...whatever the reason, it is
a simple operation requiring just a few steps.

First, always have :doc:`current backups <../maintenance/backup>`.

Next, put your ownCloud server into maintenance mode. This is disruptive and
will lock out your users, so you might warn them, and select a quiet time.
This example is for Ubuntu Linux::

$ sudo -u www-data php occ maintenance:mode --on

You must run ``occ`` as your HTTP user.

* The HTTP user and group in Debian/Ubuntu is www-data.
* The HTTP user and group in Fedora/CentOS is apache.
* The HTTP user and group in Arch Linux is http.
* The HTTP user in openSUSE is wwwrun, and the HTTP group is www.

Then copy your data directory to its new location, which in this example is
``/var/storage``::

$ sudo cp -r /var/www/owncloud/data /var/storage

Configure your new location in your ``config.php`` file, using the
``datadirectory`` parameter::

'datadirectory' => '/var/storage/data'

Run ``occ maintenance:repair`` to update the filepaths in your database::

$ sudo -u www-data php occ maintenance:repair

Take your server out of maintenance mode::

$ sudo -u www-data php occ maintenance:mode --off

Log in and make sure all your files are there, and your users' files. When
everything looks correct, you can delete your old data directory. Remember to
adjust your backups to the new location.