Jacques Blog

Blog about stuff I do?

NTFS External HD With ownCloud on the Raspberry Pi

Attempting to leave Dropbox, I decided to setup a cloud and sync solution. Dan from BitTorrent.com has a great blog post on how to setup both BTSync and ownCloud up on a Raspberry Pi. I decided to use the same type of setup. Jimmy, a mad iPhone developer, secured it a bit more and made a helpful guide. Not being a sysadmin, this helped me a lot.

Dan’s guide uses an ext4 formatted thumb drive as storage location. I want to use my external hard drive that’s ntfs. I don’t want to format it because I already have tons of stuff on there I don’t want to lose.

The default ntfs file system on Raspbian is read-only so you need to begin by installing ntfs-3g

$ apt-get install ntfs-3g

Next you need to have it auto mount on start up using /etc/fstab. Doing a basic mount /etc/sda1 /media/exthdd ntfs-3g defaults 0 0 won.t work. The reason is because by default it mounts to root and the permissions are 777. In order for ownCloud to allow the drive to be used you need 770 as permissions on whatever directory/file you want to use and you want ownCloud to be the owner.

To change permissions on a mounted HD you need to define the uid, gid, fmask and dmask options in /etc/fstab. Depending on your distribution the uid and gid will change. See the ownCloud admin manual

In my case I want www-data to be the owner.

$ id -u www-data
$ id -g www-data

Say they both return 33 here is what you would add in /etc/fstab

/etc/sda1 /media/exthdd ntfs-3g defaults,uid=33,gid=33,fmask=007,dmask=007 0 0

Hope this helps anyone with similar problems.