Quantcast
Channel: CodeSection,代码区,Linux操作系统:Ubuntu_Centos_Debian - CodeSec
Viewing all articles
Browse latest Browse all 11063

How to Add External Storage to ownCloud 9

$
0
0

OwnCloud is a server software for data synchronization and file sharing with an easy to use web-based frontend that is available under an open source license. Owncloud can be installed on a linux or windows web server, it is easy to configure and has a comprehensive online documentation.

In OwnCloud, we can add external storage as ownCloud storage devices to extend the storage capabilities of the local server. This feature makes it easy to add new storage when we have a small server. We just need to mount and add it to the ownCloud storage devices list.

Supported storage types in ownCloud:

Amazon S3 Dropbox FTP/FTPS Google Drive Local OpenStack Object Storage ownCloud SFTPS MB/CIFS WebDAV

In this tutorial, I will show you how to enable an external storage or drive in ownCloud 9. I will show you how to add a new 'Local' storage to the ownCloud server and how to mount it as an ownCloud storage device.

Prerequisites CentOS 7 OwnCloud Server Installed. Root Privileges. External drive - I will use ' /dev/sdb ' here. Step 1 - Configure the Storage Drive

In this step, we will prepare new drive '/dev/sdb' for the use in ownCloud. I will format it with an 'ext4' file system and mount it permanently with an entry in /etc/fstab to a local directory.

Connect to the ownCloud server by SSH (or open the terminal when you work locally)

ssh[emailprotected]

Check if there is a '/dev/sdb' drive available.

sudo fdisk -l /dev/sdb

Now make a new partition with thefdisk command.

fdisk /dev/sdb

Type ' o ' to create a new partition table.

Type ' n ' to create a new partition.

Choose the primary partition type, input ' p '.

Partition Number - we just need 1 .

Leave all default on the First sector and Last sector - Press Enter .

Type ' w ' and press enter to write the partition.


How to Add External Storage to ownCloud 9

The ' /dev/sdb1 ' partition has been created, now we have to format it to ' ext4 ' with the mkfs tool. Then check the volume size.

mkfs.ext4 /dev/sdb1

fdisk -s /dev/sdb1


How to Add External Storage to ownCloud 9

Next, create a new ' data ' directory and mount '/dev/sdb1' to that directory.

sudo mkdir -p /data

sudo mount /dev/sdb1 /data

Under the data directory, we've already mounted a new disk. Create a new directory ' sdb-owncloud ' in it for owncloud. Then change the owner of the directory to the ' nginx ' user, owncloud running under 'nginx' user in my setup (see my ownCloud installation tutorials here at Howtoforge for the ownCloud base setup).

sudo mkdir -p /data/sdb-owncloud

sudo chown -R nginx:nginx /data/sdb-owncloud

Run SELinux command below to allow ownCloud to write to new disk directory. This has to be done on CentOS only but not on Ubuntu and Debian.

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/data/sdb-owncloud(/.*)?'

sudo restorecon -Rv /data/sdb-owncloud/

To mount new disk permanently, we add the new mount configuration to the fstab file. Open fstab with vom:

vim /etc/fstab

Paste the configuration below at the end of the file.

/dev/sdb1 /data ext4 defaults 0 1

Save fstab and exit vim.

Now remount the disk and make sure that there is no error.

umount /data

mount -a

df -h


How to Add External Storage to ownCloud 9
Step 2 - Enable External Storage

To enable ownCloud for using an external storage, we must enable apps in ownCloud admin area.

Login to ownCloud as admin.


How to Add External Storage to ownCloud 9

Now click on the ' Files ' section and choose ' Apps '.


How to Add External Storage to ownCloud 9

Click the tab ' Not enabled ' and choose ' External storage support ', click ' Enable ' and wait.


How to Add External Storage to ownCloud 9

External storage support enabled.

Step 3 - Add New Storage

Owncloud app for 'External storage support' has been enabled. Go to the admin settings and you will see an ' External Storage ' tab, click on it.


How to Add External Storage to ownCloud 9

Add new storage, type ' Local '.

Type in the information below:

Folder name - name on the owncloud dashboard ' sdb-owncloud ' Configuration - data storage directory ' /data/sdb-owncloud/ ' Available for - this storage available for some ' Group or User '

If there is a ' Green ' color, it means available and success.


How to Add External Storage to ownCloud 9

Now back to admin file-manager dashboard, and you will see the ' sdb-owncloud ' directory.


How to Add External Storage to ownCloud 9
Step 4 - Login as Normal User

Login as anormal user, in my case the user 'hakase', and you will see that the ' sdb-owncloud ' directory is available there as well.


How to Add External Storage to ownCloud 9

When you upload a file to 'sdb-woncloud', the file is available for other users which have permission to access the 'sdb-owncloud' local storage.

Reference https://doc.owncloud.org/server/9.1/admin_manual/configuration_files/external_storage_configuration_gui.html

Viewing all articles
Browse latest Browse all 11063

Trending Articles