Impossible to add extra local storage to OC

external_storage
help

#1

Hi everyone,

I am a new user of OwnCloud and was able to set-up my own Owncloud 8.2.7 and get it up and running on CentOS 7 (minimal install with all ofther security patches installed) using Apache 2.4 (httpd) and a MySQL database.
Since there are allot of guides out there it was fairly simple to install, make the common security changes, configure APCu, setup clamscan and setup my signed ssl certificates. here :grin:

So i have been using OwnCloud for a couple of days now and i just love it!:heart_eyes:
With this in mind i ordered 2 extra 4TB disks, added them to my server in Raid-1.
Changed the partition table to GPT, added a partition, formatted it to be Ext4.
Created a mount point called, /store/ which is pointing to /dev/sdb1/ (the Ext4 partition).
Then added a folder called mkdir /store/owncloud/
After that i have set the permissions on these folders using:

chown -R apache.apache /store/*
chown -R apache.apache /store/owncloud/*

Then went into the admin interface of OwnCloud and added the folder as a Local External Storage called "Backup".
When i did this i noticed the Green dot on the left side of the External Storage line so i was happy it worked!!
(ofcourse also set it available for my users)

.. Or not...
This is where my problem is;
When i now go to my user and go to "Files > Backup " i see this line telling me "You don't have permission to upload or create files here"
Also the icon for uploading files is missing.

Since 2 days now i am stuck on this issue and i now am ready to ask for help in this forum.
I ofcourse tried everything i could think of and searched google for 12 hours straight trying to find the right awnser but i cannot seem to find it.
Also i followed all the permission scripts which are available on the owncloud.org website itself but these wont seem to work either..

I tried deleting the External Storage and re-setting the permissions and then re-add the storage, with no luck.
Also tried re-setting the permissions while the httpd service was stopped.
Tried rebooting the server multiple times..
Created new folders, folders inside folders and adding the base direcotry instead of the /owncloud/ but nothing seems to work, all with the same result.

When i run # sudo -u apache ls -la /store/owncloud, i get this output:
[CloudServer owncloud]# sudo -u apache ls -la /store/owncloud
total 492
drwxr-xr-x. 2 apache apache 4096 2 aug 12:40 .
drwxr-xr-x. 8 root root 4096 2 aug 13:45 ..
-rw-r--r--. 1 apache apache 495616 30 dec 2014 putty.exe
(i placed putty.exe in this directory which i am able to see in my OwnCloud interface inside the directory, i just cannot remove it)

When i run it on the base directory i get this result:
[CloudServer owncloud]# sudo -u apache ls -la /store/
total 44
drwxr-xr-x. 8 root root 4096 2 aug 13:45 .
dr-xr-xr-x. 18 root root 4096 2 aug 11:56 ..
drwxr-xr-x. 2 apache apache 4096 2 aug 13:45 backup
drwx------. 2 apache apache 16384 2 aug 11:54 lost+found
drwxr-xr-x. 2 apache apache 4096 2 aug 12:40 owncloud

Am i missing something ?
I checked the base /data folder for the Owncloud data which is on a other disk and those permissing seem to be the exact same...

Server configuration
Operating system: CentOS 7
Web server: Apache 2.4
Database: MySQL
PHP version: 5.4.16
ownCloud version: 8.2.7
Updated from an older ownCloud or fresh install: update from 8.1.9
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption):
i am trying to setup Local External Storage


#2

Hi,

if you do a fresh install i would recommend to install directly 9.0.4 (or maybe even 9.1.0). There is no point in using 8.1.9 in your case.

For the permission issue have a look at the following FAQ explaining most of the issues which could arise here (especially SELinux on CentOS):


#4

Hi,

in general the stuff described there is not related to ownCloud at all but to your webserver itself. The location of the files heavily depends on your used distro and used webserver so its advised to do a short research on the net where those files are located at CentOS.

Linux tools like "find" or "locate" might also support you with the task to find these files.


#6

Since my system is running SELinux, i followed the instructions to set the propper rights on the folders using these commands:
(/home/data is my home directory for owncloud data and /store/owncloud is my 2nd disk which i want to add as external storage)

semanage fcontext -a -t httpd_sys_rw_content_t '/home/data'
restorecon '/home/data'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
restorecon '/var/www/html/owncloud/config'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
restorecon '/var/www/html/owncloud/apps'
semanage fcontext -a -t httpd_sys_rw_content_t '/store/owncloud'
restorecon '/store/owncloud'

After this did a service httpd restart, deleted my added external storage and re-added it.
Stil i have the same problem.. no rights to edit files.

So now i:
- configured SELinux
- mounted storage as apache:apache
- re-setted the permissions again
- check open_basedir

Does anyone have any other suggestions ?
I am stuck here... :confounded:


#7

Hi,

for support with SELinux and similar topics its advised to get support from a CentOS community which is more familiar with the special stuff at that distro.

I'm also still suggesting to directly install 9.0.4 or 9.1.0 and directly specify the datadir to /home/data during the setup of ownCloud (moving the datadir after the installation is currently unsupported).


#9

ownCloud should never refuses to write somewhere. It just used PHP native methods so most likely that your PHP environment can still not write to that external disc.


#10

I finally found it!

So if anyone else ever wonders:
On a CentOS 7, default installation of Owncloud 8.X run the following commands;
(might work for Owncloud 9, i am not sure)

cd /var/www/html/owncloud/

semanage fcontext -a -t httpd_sys_rw_content_t '/store/owncloud/'

restorecon '/store/owncloud'

chown -R apache:apache /var/www/html/owncloud

sudo -u www-data php occ files:scan --all

This last command can take up some time depending on the speed and number of files on your server.