Change Ownclouds Data Location To An External Drive On Linux
I recently started using Owncloud for both backup and cloud solution as part of our home network. This process will improve performance and add a larger storage location for Owncloud.
You will need to make sure that your drive has been mounted and that you have access to it’s root folder. For my example, I will be referencing user “sdatic” and the drive mounted as “sdaticdrive.”
Mounting Data Location
First, we will want to stop Apache2.
sudo service apache2 stop
Create the new folder where Owncloud will store data.
Copy the contents of your Owncloud data folder to your new “owncloud_data” directory.
cp -rt /var/www/owncloud/data/ /media/sdatic/sdaticdrive/owncloud_data/
Change the permissions for your new “owncloud_data” folder.
chown -R www-data:www-data /media/sdatic/sdaticdrive/owncloud_data/ chmod -R 755 /media/sdatic/sdaticdrive/owncloud_data/
Rename the old Owncloud data directory to something like “data_old.” This will be a backup of the current data files. You can delete this directory once this process is completed to free up some disk space.
sudo mv /var/www/owncloud/data/ /var/www/owncloud/data_old/
Make a new “data” directory that will be mounted to our “owncloud_data” directory.
sudo mkdir /var/www/owncloud/data
Apply the proper permissions.
sudo chown -R www-data:www-data /var/www/owncloud/data sudo chmod -R 755 /var/www/owncloud/data
Mount the directories.
sudo mount --bind /media/sdatic/stadicdrive/owncloud_data/ /var/www/owncloud/data/
Start Apache2 back up.
sudo service apache2 start
You should now be able to access Owncloud again and file will be stored in your “owncloud_data” location.
I’ve read a few things about symbolic links that can be setup with the Owncloud configuration file but there are possible permission issues associated with the method. This process been working very well for me on Ubuntu.