How to install owncloud on your Raspberry pi with usb hdd

Published on
32,037 Points
9 Endorsements
Last Modified:
James Murrell
It's me... if google cannot help i can
These instructions are based on installing Owncloud on your new raspberry pi connected with a usb HDD.

What do you need Part A?
A Raspberry Pi, model B.
A boot SD card for the Raspberry Pi.
A usb HDD
An Ethernet cable to connect to the local network

I used the Debain image http://www.raspberrypi.org/downloads

I am assuming that you have already setup your raspberry pi (http://elinux.org/RPi_Easy_SD_Card_Setup) and are able to connect it it and run commands.

I am also assuming  that your USB hard-drive is /dev/sda1 when connected to your Raspberry pi.  
In order to make a partition accessible to the file system, you need to use the Linux "mount" command, referencing the hardware (e.g., /dev/sda1) and a "mount point" in the file system, which is any empty directory, usually created for the purpose by the user. There is a canonical (i.e., standard) directory path where mount points are usually created: the /mnt directory. You can create a new directory under /mnt for each partition to be mounted, and it can be named anything you want as long as it doesn't contain any spaces. You might want to name it to correspond to the drive's physical characteristics, e.g., /mnt/sda1, or /mnt/120GB_USB_hard_disk.

Connect to device, once connected, to find devices attached type

sudo fdisk -l

Open in new window

(This Lists HDD devices connected the system)
My output is
Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 32 sectors/track, 121280 cylinders
Units = cylinders of 128 * 512 = 65536 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ee283

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1              17        1216       76800    c  W95 FAT32 (LBA)
/dev/mmcblk0p2            1233       26672     1628160   83  Linux
/dev/mmcblk0p3           26689       29744      195584   82  Linux swap / Solaris
/dev/mmcblk0p4           29745      121280     5858304    b  W95 FAT32

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4796fc2a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       19458   156288000   83  Linux


To create Directory type

sudo mkdir /mnt/<<name of directory>>

Open in new window

(This creates a new directory for us)
Replace <<name of directory>> with your directory (with no <<>>)
Then you need to mount the hardware
sudo mount /dev/sda1 /mnt/<<name of directory>>

Open in new window

(Will mount the filesystem on /dev/sda1 which will be a USB drive)
replace sda1 with your device
replace <<name of directory>> with your directory (with no <<>>)

Ideally you want the raspberry pi to start mounted every time you start the system.

sudo nano /etc/profile

Open in new window

At the scroll to the bottom and add:

sudo mount /dev/sda1 /mnt/<<name of directory>>

Open in new window

replace sda1 with your device
replace <<name of directory>> with your directory (with no <<>>)

What do you need Part B?
All above

To install Owncloud

http://wwww.owncloud.org - Store your files, folders, contacts, photo galleries, calendars and more on a server of your choosing. Access that folder from your mobile device, your desktop, or a web browser. Sync Your Data, Keep your files, contacts, photo galleries, calendars and more synchronized amongst your devices. One folder, two folders and more – Share Your Data, Share your data with others, and give them access to your latest photo galleries, your calendar, your music, or anything else you want them to see. Share it publicly, or privately. It is your data, do what you want with it.

At time of this writing, the current version is v4, but this will not yet work with the debian OS for raspberry pi. But you can run the full V3 version.

Connect to device, once connected

sudo apt-get update && sudo apt-get upgrade

Open in new window

(takes 1 min approx)

sudo apt-get install apache2 php5 php5-json php5-gd php5-sqlite curl libcurl3 libcurl3-dev php5-curl php5-common php-xml-parser

Open in new window

(This installs Apache and all libraries required like php etc)

sudo apt-get install sqlite

Open in new window

(This installs SQL database engine)

sudo wget http://owncloud.org/releases/owncloud-3.0.3.tar.bz2

Open in new window

(This gets v3 of Owncloud)

sudo tar -xjf owncloud-3.0.3.tar.bz2

Open in new window

(This extracts the above file, and create a directory)

sudo cp -r owncloud /var/www

Open in new window

(This copies the Owncloud directory to webserver location)

chown -R www-data:www-data /var/www

Open in new window

(This provides webserver permissions for Owncloud folders)

sudo chown -R www-data:www-data <</path/to/your/owncloud/install/data>>

Open in new window

(This provide webserver permission for Owncloud usb folders)
replace <<name of directory>> with your directory (with no <<>>)

sudo service apache2 restart

Open in new window

(This restarts webserver service)

Once you have restarted you can use a web browser and go to the ipaddress of your raspberry pi
You will be asked to create admin user:
Below you will see Advanced, click that and change location to

And that is it you have your own personal cloud storage. Which you can get sync clients for most OS's and mobile platforms..

Raspberry Pi Logo (TM) http://raspberrypi.org

Featured Post

Get Cisco Certified in IT Security

There’s a high demand for IT security experts and network administrators who can safeguard the data that individuals, corporations, and governments rely on every day. Pursue your B.S. in Network Operations and Security and gain the credentials you need for this high-growth field.

Join & Write a Comment

The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Discover the basics of using Outlook 2016 from office 365.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month