Home > Blog > Programming > Configuring External Storage for ownCloud

Configuring External Storage for ownCloud

June 10th, 2012

One of the features that I worked on for ownCloud 4 was the mounting of external storage directly into your ownCloud. No longer are you limited by the storage capacity of the server ownCloud is running on. Despite being labeled as an ‘experimental’ feature in the release announcement, many users requested help configuring it. With no user interface available and limited documentation to configure the external storage it seems all users were confused and frustrated. So, I set aside a few days and tasked myself with finally creating a usable user interface to configure external storage. This is the result of that work:

 

To add an external storage backend to your ownCloud head to Settings -> Admin or Personal. As an admin you can mount external storage for any group or user. Users are also allowed to mount external storage for their selves if this setting is enabled by the admin. The first step is to set the mount point, this is the directory that the storage will be mounted to. Next, select a backend from the list of available backends. ownCloud currently supports: Amazon S3, Dropbox, FTP, Google Drive, OpenStack Swift, SMB, and WebDAV. Local file storage can also be mounted that is outside of your ownCloud’s data directory. Users are restricted from mounting local file storage in the Settings -> Personal page, because this is a security risk.

Once a backend is selected, more configuration fields will appear. The configuration fields requested vary depending on the selected storage backend. For example, the FTP storage backend needs the following configuration details: url, username, password, root (optional), and an option for ftps://. The root option is the directory at the external storage that will be mounted.

This is available in the master branch and will not be included until the ownCloud 5 release. Documentation for manually configuring external storage is available at ownCloud.org. No error checking has been implemented at this time, so make sure all configuration fields are entered correctly.

Support for mounting Google Drive and Dropbox through this user interface will be added later in the week. These require some more work because of the OAuth authentication.

Categories: Programming Tags:
  1. Eike
    June 11th, 2012 at 10:02 | #1

    Hi Michael,
    seems to be a very helpful interface for a lot of people who want to enhance their oC easily.
    Is there any possibility to use your newest development directly? To be hones: I don’t want to wait until the release of oC5 ;)

    Cheers Eike

  2. June 11th, 2012 at 10:54 | #2

    @Eike You can either start using the master branch at gitorious or download the files inside the folder apps/files_external.

  3. June 11th, 2012 at 13:59 | #3

    Wonderful news! I just got it working on OS X Lion Server (don’t ask me how, I’m still not entirely sure) 10.7.4. After failing once with Windows XAMPP and failing once with XAMPP for Mac.

  4. mrw
    June 12th, 2012 at 10:30 | #4

    Hi Michael

    Thanks, but I don’t succeed. I tried both, first the manual configuration in config/mount.php, then with your GUI-config. Both don’t work.

    I’m using 4.0.2 from owncloud’s package repository. in the second step, I only rsynced “owncloud/apps/files_external/” to “/var/www/…”, everything else is 4.0.2.

    How can I debug?

    I tried to add some log into my php code and found, that the config file is read and method “mount” in lib/filesystem.php is called with meaningful parameters.

    But still, the mounted pathes don’t appear in “files” and there’s no debug nor error log.

    I try to access local media files that are outside of owncloud, especially in “/var/data”. User www-data has read access, but not write access. But I also tried to mount “/var/www/test” that is owned by www-data – nothing happens, nothing works at all. :-(

    Any idea, any help, any tip?

    The config file mount.php now contains:
    —————————————————
    array (
    ‘all’ => array (
    ‘/$user/files/bilder’ => array ( ‘class’ => ‘OC_Filestorage_Local’, ‘options’ => array ( ‘datadir’ => ‘/var/data/Bilder’, ),),
    ),
    ),
    );
    ?>
    —————————————————

  5. June 12th, 2012 at 14:46 | #5

    @mrw I forgot to mention that you need to create a directory in order to see it in the web interface. I’ll fix it so it automatically creates a directory when you mount something.

  6. mrw
    June 13th, 2012 at 03:22 | #6

    You’re great, that’s it!

    If I knew this, I didn’t even need a GUI Interface, mount.php is also fine for me, bnow that I found the syntax documentation (you just need to know it, instead of clickediclick, a link to the respective documentation from the OwnCloud UI to the documentation just where you enable the App would help) ;-)

    Please also change it here: http://owncloud.org/support/custom-mount-configuration/ (if you have access).

    By now, OwnCloud seems to be what I was looking for for years: a simple an easy to use way to share family fotos and movies with parents, but on my ohn computer and in privacy.

    Thank’s for the good work. :-)

  7. mrw
    June 13th, 2012 at 10:56 | #7

    How to *remove* a local filestorage?

    I removed it from mount.php, then removed the folder, but the images are still in «Pictures».

  8. June 13th, 2012 at 12:14 | #8

    @mrw Thanks for the kind words.

    This is an issue with the pictures app. Hopefully by the next release will get everything sorted out with apps working with files.

  9. guest
    June 17th, 2012 at 09:51 | #9

    Hi Michael

    I got it working :-) I can upload or edit files from an external storage, but versioning does not work for me. Is it a bug or just not yet implemented?
    If you mount your dropbox, versioning is not needed, because dropbox has its own versioning, but if you mount a webdav storage, it would be an important feature for me.

    Thanks so far :-)

  10. June 17th, 2012 at 11:32 | #10

    @guest The versions app doesn’t use ownCloud’s internal filesystem functions, which is why versioning isn’t working for external storage. This will be fixed in the future.

  11. Conor
    June 20th, 2012 at 16:17 | #11

    Any plans on adding Windows Skydrive, Box.com, iCloud, Amazon Cloud drive, etc.

  12. June 20th, 2012 at 17:54 | #12

    @Conor There is already support for Amazon S3. There are no official plans for any other backends, but it is relatively easy to add support for other services if they provide an API.

  13. Papak
    June 21st, 2012 at 09:04 | #13

    I just added FTP backend and seems to went fine but folder for moutpoint is empty. I don’t see files from my ftp host. Am I wrong or don’t understand the point od external storage?

  14. June 21st, 2012 at 10:03 | #14

    @Papak The file cache might not be scanning the mount point correctly. Are you using the master branch?

  15. Papak
    June 21st, 2012 at 12:42 | #15

    Yes. I’m using master branch.

  16. gilberton
    June 22nd, 2012 at 11:34 | #16

    Hi Michael, I installed Wamp server on my local machine and create an app in Dropbox to get the keys as you explain to associate dropox in owncloud. I downloaded the master branch and I got the external storage API. The problem I got is nothing happen when I clicked on “grant access”. I looked in my Firefox java console and I got:
    POST http://localhost/owncloud-owncloud/?app=files_external&getfile=ajax/google.php [HTTP/1.1 200 OK 181ms]. It seems the request is sent but no response. Do you have an idea?

  17. June 22nd, 2012 at 12:45 | #17

    @gilberton A dialog should appear if there was an error. I’m a little confused because you said you were trying to configure Dropbox, but it looks like it was trying to configure Google Drive instead. Stop by IRC and I’ll try to help.

  18. Papak
    June 26th, 2012 at 14:37 | #18

    @Michael I have the same problem as gilberton. The same happen by Dropbox or Google Drive.After Grant access I’m forwarded to ownCloud config page but external storage isn’t configured.

  19. June 28th, 2012 at 12:32 | #19

    @Papak Stop by IRC and I’ll try to help.

  20. Erwan
    June 30th, 2012 at 08:24 | #20

    @Papak you can test the 3rd-party app rescan_fs, it has been the solution for me

  21. gilberton
    July 2nd, 2012 at 09:32 | #21

    Hi Michael, thanks for replying I did some progress last week. I found that my problem was related to the curl library that didn’t load because I use wamp for windows 64 bits, I downgraded to 32 bits and Curl loaded fine. Then after downloading the last master branch you upgraded I am abble to get Google drive working and appearing on the file menu. However I still have a problem with Dropbox that gives me the error message: “fetching request tokens failes. Verify that your Dropbox app key and secret are correct”. I tried several time with fresh created appli and Dropbox but nothing change. I looked in Apache error log and get:[Mon Jul 02 15:01:51 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/wamp/www/owncloud-owncloud/data/htaccesstest.txt. As far as I find on the web htaccesstest.txt is not the problem as it is just for test. Do you have an idea?

  22. Papak
    July 3rd, 2012 at 03:58 | #22

    @Michael Gapczynski

    What’s your nich there?

  23. Papak
    July 3rd, 2012 at 03:59 | #23

    @Michael Gapczynski

    Sorry I meant nick.

  24. July 4th, 2012 at 10:34 | #24

    Michael, Good plugin but I believe you need to rethink some parts a bit.
    1. If I add a storage that should be used by all users, They all need index this External Storage?
    2. If it’s a gigantic storage, indexing it thru the webbserver will time out. How about creating a backend crontabbed indexer?
    3. If scanFiles() is initiated. Will it then try to rescan the gigantic External Storage?

  25. July 6th, 2012 at 20:15 | #25

    @gilberton Not sure, but Windows often has strange problems. Both you and Papak should stop by IRC :)

    @Papak My nick is MTGap

    @Raboo 1: Yes, unfortunately the file cache wasn’t designed for this type of thing and will need some improvements in the future. 2: I think it would be better to continue improving the file scanning instead. 3: Yes, it will.

  26. July 9th, 2012 at 05:20 | #26

    Michael, well perhaps then it’s better to have the storage and external storage work differently?
    Might be better to have external storage more like a filebrowser without indexing. So it justs brows and list files as it goes and no indexing? Cause even if indexing is improved, it will still not be able to work good with bigger storages housing many files.

Comments are closed.