I succesfully installed owncloud on my raspberry pi, but I want to upload files to my hdd when I upload on owncloud. So I did this:

cd /var/www/owncloud/config
sudo nano config.php

and I changed the

'datadirectory' => 'mnt/usbdrive/owncloud'

/mnt/usbdrive/ is a directory on the raspberry where the hdd is mounted

/owncloud/ is a directory I made on the hdd.

So this should work, but the problem is. It doesn't since the


is empty when I reboot. And when I manually try to mount it again, the url: serverip/owncloud (so basically the owncloud page) is empty. ( I think it's because I changed something while it was still running). Now dont take my word on the this but I thought about some possible situations/solutions, but I also have no idea how to solve this:

  1. I think that the raspberry must be automatically mounted at booting since the owncloud automatically boots as well.

  2. The owncloud should be stopped, with a command(no idea which command) , then I can manually mount the hdd and I can start it again.

I have no idea if this would work, if I am right or how to do this>

So I'll just ask a couple of questions first.

Is one of the listed situations the situation I am in now? ( So will one of the solutions work?)

Why is there a blank page on the owncloud url when I manually boot the hdd while the owncloud is still running?

If one of the listed situations is the situation, how do I execute the solution?

Also, if I dont change the data directory to the directory on my hdd,but keep it the same, it works perfectly. Of course I dont want it to keep it the standard since I dont wanna upload on the raspberry but on the hdd.

Before mounting the hdd and accessing the owncloud will just give me the header of owncloud + an error saying: "Failed to connect to database" That's probably because the data directory doesn't exist because the hdd isn't mounted yet.

So overall I think the thing that is wrong right now is: I boot the raspberry pi, so owncloud boots as well. The hdd isn't automatically connected, so I have to manually connect it while owncloud is still running. After mounting, I try to go to: raspberrypi-ip/owncloud and it's a white screen. In order to lose the white screen, I should reboot the raspberry. Which brings me back to the beginning.

NOTE: I do use a powered usb hub

2 Answers 2


Have you tried adding the mount for the USB drive into /etc/fstab so it gets mounted at boot?

Wikipedia has some example mount lines for different devices: https://en.wikipedia.org/wiki/Fstab

  • I did try it but multiple websites all told me different to do this. I tried a few and it didn't work :S. Do you have a working link?
    – Loko
    Nov 20, 2013 at 11:23
  • NVM The wiki link worked. Never expected wiki would help in this kind of situation. Thanks
    – Loko
    Nov 20, 2013 at 11:43

currently I am working on a project exactly like this right now. What you need to do is to mount it in /etc/fstab. To help you in more detail this is my best practice. When you format your hard disk with ext you get a uuid - a unique identenifier. You can use this to mount only a specific hard disk to a specific mountpoint and not the first hard disk connected (example: sda). You get the uuid by typing sudo blkid /dev/sda1 be sure to edit /etc/fstab like described here https://wiki.debian.org/fstab

what you need is the nofail option, because you will get in the situation where the harddisk has problems when the PRi is not properly shut down. With nofail the RPi boots even if the harddisk mount fails.

sudo blkid /dev/sda1 /dev/sda1: SEC_TYPE="msdos" UUID="C0FF-33DE" TYPE="vfat" here you take the uuid and paste it into your /etc/fstab to look like this

UUID=C0FF-33DE  /mnt/usbdrive               ext4     rw,suid,dev,exec,auto,nouser,async,nofail  0       2

after reboot your usb drive should be automounted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.