Like every other website on the planet, SmallNetBuilder uses cookies. Our cookies track login status, but we only allow admins to log in anyway, so those don't apply to you. Any other cookies you pick up during your visit come from advertisers, which we don't control. If you continue to use the site, you agree to tolerate our use of cookies. Thank you!

Router Charts

Router Ranker

NAS Charts

NAS Ranker

More Tools

NAS How To

Introduction

Over the past few months I've been testing out many of the emerging NAS-as-HTPC solutions from various vendors, often with very mixed results. I also tested out a Raspberry Pi as an HTPC to see how well it would fare against the various NAS'. Turns out it did pretty well, so we decided to flip the tables. We wanted to see if a Raspberry Pi could take the place of a NAS.

With that I mind I disconnected Raspbmc from our TV, popped in a new SD card, pulled out my USB drive enclosure and set to work building R-Pi NAS. As you can see in the picture above it wasn't necessarily an aesthetically elegant solution, but it was functional and served the purpose it was designed for.

Setup

When calling the R-Pi NAS a NAS, I guess in the strictest sense of the word it is network attached storage. However, there is no dedicated NAS software for R-Pi NAS. Repurposing it as a NAS involves installing various Linux applications and configuring them via SSH command line.

When I first set up the R-Pi NAS, I wanted the option of connecting via an SSH client or by using Windows Remote Desktop Connection. To accomplish the latter I installed xrdp, which uses VNC to allow the Windows RDP client to connect to Linux. The command to install xrdp was simply:

sudo apt-get install xrdp

The xrdp installer will download the needed files and run through the install. Once complete, you'll be able to log into the Raspberry Pi via Windows Remote Desktop, which you see in the image below.

Raspberry Pi xrdp screen

A more verbose explanation of the xrdp installation can be found in the great guide at An Unofficial Raspberry Pi Blog. The image below shows the VNC/RDP connection screen.

Raspberry Pi xrdp connection screen

Even if you are not necessarily comfortable in Linux, in time you'll more than likely gravitate towards using the Raspberry Pi via an SSH client. Much of the setup and configuration of R-Pi NAS needs to be done via command line anyway, so it makes sense. To install R-Pi NAS I followed the instructions at eLinux.org, with some supplemental instructions along the way.

The next step of the installation was to configure a Samba server so it could seamlessly interface with Windows machines, which is most of what we have in the house. The command for this was:

sudo apt-get install samba samba-common-bin

Setting up Samba, especially the first couple times around, can be rather tricky. As a supplement to the R-PI NAS instructions, I also followed the information from Simon the Pi Man, which really completed the picture and helped me get Samba going with no issues.

When Samba was up and running, it was time to connect my USB drive. I used a 2 TB Hitachi drive in a Rosewill external enclosure. The enclosure is USB 2.0, which is fine since the Raspberry Pi only supports USB 2.0. I first made a directory that the USB drive could attach to, simply:

sudo mkdir /mnt/2TBdrive

Then I mounted the drive:

sudo mount /dev/sda1 /mnt/2TBdrive

I am by no means a 'nix expert and a lot more could be said about that. Linux.org has an excellent article on adding USB drives.

Lastly I edited /etc/fstab to ensure the drives remained even after a reboot. Since I was going to be changing filesystem types and didn't want to change the line each time, I added the following line to /etc/fstab, which you can also see in the screenshot below it.

/dev/sda1 /mnt/2TBdrive auto noatime 0 0

R-Pi NAS fstab entry

My R-PI NAS installation was complete and I was ready to test. The screenshot below shows the USB drive as part of the filesystem and ready to go.