Using OwnCloud with an NTFS file share [Updated]

Trying to use NTFS with your OwnCloud server? You may be running into some challenges.

My setup

I'm running OwnCloud 8 server in a Linux Mint VM (VMware Workstation) for personal use. It uses a USB 3.0 2TB drive formatted as NTFS and it works pretty darn well.

I won't be going over how to setup OwnCloud server in Ubuntu - if you're interested in that, here's a great guide by our friends over at Noobs Lab (I highly recommend using MySQL or any other database solution over the included SQLite.. you will have major performance issues if you use SQLite)

The reason I wanted to go this route with my configuration is because I can have a small (~20GB) Ubuntu Server utilizing a larger external drive that can be easily read by both my Linux Server, as well as my Windows host machine. Smaller VMs means more internal space on my host machine!

At first I thought I could simply "pass through" my drive to the VM for hosting my personal cloud, similar to how I configured my Plex Server. Unfortunately the system was having trouble recognizing the pass-through (even though file syncing actually worked when manually copying files to the share.. very strange). I would see an error similar to the one below:

Data directory (/mnt/hgfs/owncloud/data) is readable by other users.

Please change the permissions to 0770 so that the directory cannot be listed by other users.

I was unable to change the permissions on the NTFS mount when it was configured this way.

Through researching the issue and the options available, I decided the easiest method to continue to use NTFS with this setup is to create a Windows share on my owncloud data folder, and mount it as a CIFS share to the OwnCloud server.

What you'll need

  1. Host machine with VMware Workstation (or similar software)

  2. OwnCloud server in a Ubuntu-based Virtual Machine (~20gb vm)

  3. External USB 3.0 Drive formatted as NTFS

  4. Patience and determination!
On to the how-to:

I should preface this section: this setup works for me and my needs, which is a single-user personal setup. This is not recommended for a multi-user, production configuration.

  1. Remove any VMware Workstation-based pass through you have configured for the NTFS drive. This may require you to power off the VM and delete the pass through.

  2. On the host side (in my case, Windows 8.1 Windows 10) create a local user account dedicated for owning the share. This will be used later when we mount it to Linux. In my example, ocadmin

  3. On the host side, create a normal share on the folder you'll be using as the owncloud data folder (right click, properties, Sharing tab, Share...) and give full permissions to the user account you created. This should create a share location similar to \\hostname\data

  4. Now login to the OwnCloud server, edit your /etc/fstab using vi, or gedit, or what have you. At the bottom of the file, add an entry that looks like this://<ip of host>/data </location/to/put/share> cifs uid=www-data,username=ocadmin,password=<your password>,iocharset=utf8,file_mode=0770,dir_mode=0770,sec=ntlm 0 0Tips:<ip of host> This is the IP of the machine running Workstation
    </location/to/put/share> This is where the share will be mounted to the Linux OwnCloud server. This could be your Linux Home folder, desktop, documents folder.. the options are endless... endless
    www-data is the default OwnCloud server account running the owncloud service
    ocadmin/password is the local host machine account we careated earlier

  5. Now we need to make OwnCloud aware of the location we want it to use for storing files. Edit the config.php file to include the you typed above.sudo vi /var/www/owncloud/config/config.phpModify the 'datadirectory' field to your new location so it reads something like:'datadirectory' => '/var/www/owncloud/data',

    Save and close this file.

  6. Now in the terminal, type sudo mount -a and ensure there are no errors mounting the share we configured in fstab.

  7. Give your Linux system a quick reboot and you should no longer receive the errors at the top of this post when accessing your OwnCloud URL.
[Update, May 13 2016]

If you've followed this method and are planning on an upgrade from OC8 to OC9, be sure to read the OC Upgrade documentation very carefully as it states, "When using an NFS mount for the data directory, do not change its ownership from the default. The simple act of mounting the drive will set proper permissions for ownCloud to write to the directory. Changing ownership as above could result in some issues if the NFS mount is lost."

Did this post help you? Let me know in the comments!

comments powered by Disqus