Right now, I’m too poor to get a Synology DS415 play. I may not have the money, but I have a very good imagination and a Raspberry Pi. Perhaps if you are reading these words you have (or planning to have) the RPI too. While it is not that hard to hook up an HDD to a Raspberry Pi and store files on it, it becomes a challenge if you wish to have RAID support and DLNA services available. This is the story of the Raspberry PI NAS -pi network-attached storage for a fraction of the price.
Raspberry PI NAS – NASpi
I’m aware of serious limitation that comes with the RPI -Ethernet 10/100. Perhaps this would never be a solution for you, or perhaps it could! Raspberry PI NAS -pi will be shared in my household between 4 computers and a PS4. It will be a backup unit, where files like pictures and documents will be stored on a RAID1 protected drive. In addition to that, universal storage will be added to keep the media files for DLNA purposes. I know for a fact that there will be never more than 2 users accessing the NAS-pi at the same time and majority of files saved on the drive will be below 10MB.
If this is you, perhaps you should not dismiss the Ethernet 10/100 straight away. While far from perfect this a very workable solution, especially at that price. I have tested the prototype with the Raspberry Pi 2 and 3, and since there was no visible difference – RPI2 will be the device I will use for the build.
Cost
I will assume you already own a Raspberry PI. I think it is fair to do so otherwise you wouldn’t be reading this. With that cost aside ($35 or less as you can hunt for RPI2 models) the box alone is pretty cheap. The prototype costs $12 mostly because I had the SATA connectors salvaged from the external drives a long time ago. You can get the cables from $2 on aliexpress.com if you don’t mind the wait.
While that $18 (3HDD option + storage) solution works well and can be placed inside of the box or something, this is not how I imagine my final result.
MIN | OPTIMAL | MID | |
RPI** | 28.99 | 28.99 | 28.99 |
HUB | 9.99 | 9.99 | 9.99 |
HDD enclosure x3 | 0 | 12.36 | 12.36 |
HDD sata2USB x3 | 6 | 0 | 0 |
USB | 0 | 1.59 | 0 |
Gigabit USB | 0 | 8.59 | 0 |
Case | 0 | 15 | 11 |
Heatsink | 0 | 3 | 0 |
PRICE £ | 15.99 | 50.53 | 33.35 |
PRICE $ | 20.6271* | 65.1837 | 43.0215 |
This should give you the price reference for the build. The case price is the price of acrylic glass sheets needed to enclose the build. **Prices of the RPI are not included in the calculation.
Performance
We know now – how expensive it can be. How fast will it work? I’m not a big fan of synthetic benchmarks. They never give you an easily understandable picture of what to expect. Here is what to expect:
NAS
During my test, a 1.03GB file was transferred to the NAS-pi within 1 min 45 seconds. The same operation when reading the file took 15 seconds less. A collection of 30 pictures from my DSLR (8MB per picture as JPG- 186MB) has been sent to the NAS-pi in 25 seconds. Opening the picture (8MB) from the drive took less than a second.
DLNA (video streaming)
I was easily able to stream any mp4 file saved from YouTube (4k files included). It is worth noting that these are not the ‘real’ 4k files (lowered bitrate, but 4k resolution).
I have tested video files up to 9GB (2h video at 10Mbps ) in total, and I was able to play a steady stream without any issues. It is worth noticing that you may want to double check the playback device codecs as PS4 was not able to handle AAC audio with multiple streams.
In short, unless you are keen on streaming Bluray quality content you should not have any issues with the playback. Very good indeed!
NAS-pi Storage
Three drives will be connected to the RPI2. All of them has been salvaged from laptops that were no longer able to use it. There is no need to get a bigger or faster drive for this build as the biggest bottleneck will be the Ethernet 10/100 port. Another important reason why I’m choosing the 2.5” HDD is the size. I’d like to keep the size of the box as small as possible.
RAID1
The bottleneck means that we don’t have to concern ourselves with disk speeds and RAID1 (mirroring) will be a perfect solution to keep the drives fault free. It matters more as the drives are not new. For this purpose, I have two 160GB drives. I’d say this will be sufficient for all files and photos I have. Because I’m bored (or I needed a challenge) hard drive will be also hot-swappable. Something tells me this will become an issue later on when designing a cover for the Raspberry PI NAS -pi. Drives are formatted in Ext4.
MAIN STORAGE
My media storage is another drive 1.4TB. This should be sufficient for anything I wish to store on it. The drive will be formatted to NTFS as I’d like to transfer all my files in an easy way and I have a SATA reader built into my PC case. I will be able to unmount the drive and move the files manually if I wish so.
Power struggles
When prototyping the Raspberry PI NAS -pi I quickly realized that I will need much more power than RPI is able to give. In fact, much more than a standard USB 2.0 hub would give you. To make the entire project more difficult I only want a single power cable to run from the mains to the NAS-pi.
After testing few hubs (and failing) I found something small and powerful enough to supply that amount of current to all the drives and the Raspberry Pi as well. It would be easier if the size was not a concern.
The hub is a 4 port USB 3.0 with a power microUSB socket and it is available from TeckNet. The hub is powered by the original 2.5A power supply that came with the Raspberry Pi. If you can get a 3A one, you should as both drives and Raspberry Pi will be connected to the same hub and draw the power.
Shopping list:
Item | Amazon UK | Amazon USA | Aliexpress.com | Banggood.com | Comments |
1 x USB 3.0 4 port hub | £8.99 | $9.99 | $6.64 | $11.99 | I picked the microUSB powerd one, other are available |
4 x USB angled cables | £6.99 pack of two | $6.99 pack of two | $1.68 | $2.99 | Plan the bends accordingly |
1 x 2.5 -3 A 5V power supply | £5.79 | $8.99 | $4.99 | $5.75 | Works from 2.4A but aim for 3A if possible |
1 x Raspberry PI 2/3 | £32.00 | $35.10 | $39.50 | $39.99 | There is no speed penalty for RPI2 |
3 x HDD | £5.95 | $8.99 | $8.49 | $9.49 | Needs to have a specific opening mechanism |
USB hub with power 2.5A | £12.22 | $16.99 |
The NAS-pi prototype
While prototype works, it is not something I would like to keep in the current state in my living room. While being more than capable, it looks ugly and needs a container. This is where the majority of the Raspberry PI NAS-pi fund will go. I’d like to build the smallest enclosure possible that allows me to fit 3 drives inside while allowing hot-swapping. The only cables I’d like to see outside is the Ethernet cable and the power one. This means some work has to be done on the Raspberry Pi itself. The container will be built from 5mm thick acrylic glass. This should provide a nice finish, and with a massive selection of colours, I could even make it look attractive.
In part 2 we will cover all the modifications that need to be done to the Raspberry Pi to fit it inside the case.