Remote Hard Drive Access


10 posts
by maxxiejw » Wed Feb 06, 2013 8:56 pm
I do a lot of traveling and what I want to do is connect my external hard drive to a device and be able to access it away from home. I want to access both files and be able to stream the videos from it.
I don't know much about accessing a hard drive across the internet, but I was wondering if it's possible with the raspberry pi?

Thanks :)
Posts: 2
Joined: Wed Feb 06, 2013 8:49 pm
by alexeames » Wed Feb 06, 2013 9:39 pm
Yes it is. There's quite a few threads on it. What sort of drive is it?
Alex Eames RasPi.TV HDMIPi.com RasP.iO
User avatar
Posts: 2079
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by maxxiejw » Wed Feb 06, 2013 10:32 pm
It's a Hitachi Touro Desk Pro 2TB USB 3.0 :)
Posts: 2
Joined: Wed Feb 06, 2013 8:49 pm
by sim_tcr » Thu Feb 07, 2013 11:29 am
maxxiejw wrote:It's a Hitachi Touro Desk Pro 2TB USB 3.0 :)


Connect your drive to one of the usb ports on your raspberry pi.
Create a folder to mount this HDD
Code: Select all
sudo mkdir -p /mnt/hitachi

I am assuming this drive is formatted as NTFS, so you need an additional software called ntfs-3g. Install it by issuing below command
Code: Select all
sudo apt-get install ntfs-3g

Mount the HDD as below.
Code: Select all
sudo ntfs-3g /dev/sda1 /mnt/hitachi

Now if you cd to /mnt/hitachi you can view the contents of HDD.

To access this contents from internet, you need to first setup your pi be accessible from internet.
First assign a static address to you pi, details are at http://raspisimon.no-ip.org/ipaddress.php
Now forward your ssh port (by default port 22) in your router using the above assigned static address.
Now if you know your wan ip address, you can access your pi from internet. It is very easy to setup a domain name and map it to your ip so that whenever your wan ip changes, the name to ip mapping happens automatically. Details at http://raspisimon.no-ip.org/noip.php
Now you can use a software named winscp to access the HDD contents remotely using GUI interface. http://winscp.net/download/winscp513.zip
Accessing speed may depends on your home internet connection upload speed and the download speed of your outside internet connection.

Note: when you open your Pi to internet, it is always advised to,
change the passwords of 'pi' and 'root' accounts.
change ssh port to a random port (this can be done in /etc/ssh/sshd_config)
Also setup key based authentication and disable password based authentication.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Transcend 16GB Class 10, Transcend 8GB Class 4, Nokia Travel Charger ACP-12E 5.7V 800mA, Netgear WNA1000M Wifi Dongle/Ethernet
Posts: 311
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
by ski522 » Thu Feb 07, 2013 12:01 pm
maxxiejw wrote:I want to access both files and be able to stream the videos from it.

The Pi doesn't have the horse power to transcode and stream across a network. You would need a much faster system, then you can install Plex Media Server (http://www.plexapp.com/) for streaming remotely.
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by klricks » Thu Feb 07, 2013 1:54 pm
sim_tcr wrote:...
...
To access this contents from internet, you need to first setup your pi be accessible from internet.
First assign a static address to you pi, details are at http://raspisimon.no-ip.org/ipaddress.php
Now forward your ssh port (by default port 22) in your router using the above assigned static address.
...
...

Is it really necessary to set up a static IP?
I do DHCP reservations on my router:
First I find the RPi in the client list on the router
Then I assign an IP address within the DHCP range such as 192.168.1.123.
Now the RPi always gets the same IP address and there is no configuration needed on the RPi.
Am I missing something?
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://home.budget.net/~klricks/Comp/RPi/Rpi.html
Posts: 1464
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
by sim_tcr » Thu Feb 07, 2013 2:05 pm
klricks wrote:
sim_tcr wrote:...
...
To access this contents from internet, you need to first setup your pi be accessible from internet.
First assign a static address to you pi, details are at http://raspisimon.no-ip.org/ipaddress.php
Now forward your ssh port (by default port 22) in your router using the above assigned static address.
...
...

Is it really necessary to set up a static IP?
I do DHCP reservations on my router:
First I find the RPi in the client list on the router
Then I assign an IP address within the DHCP range such as 192.168.1.123.
Now the RPi always gets the same IP address and there is no configuration needed on the RPi.
Am I missing something?


I guess by doing dhcp reservation in the router, router note down pi's mac address and always assign the same address to pi. Or in other words router reserves a particular ip addreSs for a mac address.
http://raspisimon.no-ip.org
Raspberry Pi Model B x 2, Transcend 16GB Class 10, Transcend 8GB Class 4, Nokia Travel Charger ACP-12E 5.7V 800mA, Netgear WNA1000M Wifi Dongle/Ethernet
Posts: 311
Joined: Tue Nov 06, 2012 1:01 pm
Location: Bangalore
by klricks » Thu Feb 07, 2013 2:30 pm
sim_tcr wrote:I guess by doing dhcp reservation in the router, router note down pi's mac address and always assign the same address to pi. Or in other words router reserves a particular ip addreSs for a mac address.


Correct the MAC addresses off all connected devices are displayed in the DHCP reservation table and referenced to the client name. raspberrypi
If not connected then the MAC address can be entered manually.
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://home.budget.net/~klricks/Comp/RPi/Rpi.html
Posts: 1464
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
by alexeames » Thu Feb 07, 2013 2:37 pm
klricks wrote:
sim_tcr wrote:I guess by doing dhcp reservation in the router, router note down pi's mac address and always assign the same address to pi. Or in other words router reserves a particular ip addreSs for a mac address.


Correct the MAC addresses off all connected devices are displayed in the DHCP reservation table and referenced to the client name. raspberrypi
If not connected then the MAC address can be entered manually.


Yep - I use the same reservation technique. It gives a specific IP address to each MAC. A wifi dongle has its own MAC too.

One thing I'll add for the OP is that disk performance on the Pi is 3-fold increased if instead of formatting the disk as NTFS you have it as EXT4. The downside is the HDD won't be directly usable on Windows machines without installing additional software, but it will massively speed up the file transfer between Pi and HDD.

I would also set up ssh login with keys and disable passwords, then use an sftp client to get your files. I'm not sure about streaming, but I'm sure others will chip in with comments.
Alex Eames RasPi.TV HDMIPi.com RasP.iO
User avatar
Posts: 2079
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by Magic Knight » Fri Feb 08, 2013 9:43 am
I connect remotely same as above with a few differences.
Router (BT hub2) - 2 changes, port forward ssh and also setup dynamic dns
Get a free dyndns account here https://www.dlinkddns.com/login this will allow you to connect to your pi from anywhere with a dedicated web address.
I haven't needed to mess around with IP addresses, my pi always connects to my wireless network with the same ip address.
Software - I use Filezilla portable. Connects via ssh, nice interface and portable, keep it on your usb stick.
Posts: 15
Joined: Sat Jan 12, 2013 5:14 pm