Jump to content

The Raspberry Pi is quite a capable little computer. It's not gonna give you mind boggling performance by any means, but for light use, it's ideal for anyone who doesn't want to shell our hundreds of dollars a year for electricity on a purpose built NAS.

 

0. Table of Contents

  1. Backstory (done)
  2. Basic Setup and Usage (done)
  3. Enter the Raspberry Pi 3 (done)
  4. Modifications (done)
  5. Upgrading the Network Speed (done)
  6. Additional Functionality (WIP)
  7. Safeguarding Against Corruption
  8. Storage Upgrade

 

1. Backstory

Over the past month or two, I’ve been looking into various solutions for data storage. I was never looking for anything that could store petabytes of data or be used for 8K@240fps video editing over an ultra-high speed 10 terabit network. Instead I was more interested in finding a cheap, fast, and super power efficient solution that will primarily be used as a hard drive available to all the computer and HTPC’s in my house. Here are the solutions that came to mind:

 

- Cloud Storage (i.e. Dropbox, Google Drive, OneDrive)

This was naturally the first thought that came to mind as they’re all tried and true methods of storing files to be accessed by multiple users.

Pros

  • Child’s play to set up
  • Most provide desktop and phone integration applications for file access
  • Reliable

Cons

  • Low amounts of free storage
  • Require network connection at all times
  • Almost unusable when you have 100 GB’s of data to upload with a 1Mbps upload speed

 

My Personal Computer

It’s on for most of the day anyway, why not?

Pros

  • Pretty much already set up and ready to go with Samba
  • No additional programs needed
  • Does not require internet connection at all times

Cons

  • Consumes a little more power than I’m willing to pay for
  • The computer’s in my room and it kicks off a lot of heat
  • Annoyingly loud when I’m trying to sleep

 

- Custom Built NAS Computer

I’ll take any excuse I can get to order computer parts and put them together like a hi-tech puzzle!

Pros

  • Completely custom in every aspect
  • Fun
  • Cheaper than a Pre-Built

Cons

  • Can get quite expensive with drives
  • Can consume a lot of power depending on the number of drives and users hitting it

 

- Pre-Built NAS Box

Don’t know much about these at all…

Pros

  • Relatively simple to set up
  • Purpose built, so I’m assuming they’re more stable than most custom solutions

Cons

  • Very little customization
  • Too expensive for not including the drives 

As you can probably tell, I’m very picky with this sort of thing. No one solution has everything I want and I want everything I want in said solution if I’m going to use it. So after spending another week or so doing some research, the Raspberry Pi 3 I ordered ages ago came in and then it hit me, “I have an old RPi 2 that I’m not using for anything atm, so why not use it?!” It's small, cheap, power efficient, quite capable, customizable to hell and back, and fun to work with!

 

2. Basic Setup and Usage

After a quick Google search I came across this tutorial explaining how to turn the RPi into a basic NAS. It literally took me minutes to get everything set up and working. However, after doing some simple benchmarks to gauge the speed of the new NAS, I realized that this might not be the solution I was looking for; namely because of the storage capacity and the network speed.

 

Problem: Storage – Temporarily Fixed
I had a 16GB SD card as the storage… That would work for like 3-6 movies at a time and leave room for little else. This was a simple fix as all I had to do was buy a 128 GB USB 3.0 flash drive for $34 to use as the primary storage for the Samba shares. Now I’m considering buying another 3 of those and pooling them using LVM into a single 512 GB volume. I’m well aware that flash drive storage is about as impractical as it gets. It’s not worth the money you’re be paying; at $34 a pop 512 GB’s will run you $136 plus tax whereas a single 4 TB external hard drive will run you about the same if not less. It’s not reliable for high write usage; naturally, as with all flash based storage, the memory chips degrade over time. This is just more of an experiment for the moment and I most likely won’t resort to using flash drives as a permanent solution.

 

Problem: Network Speed – Working on it…
For those who don’t know, the RPi only has 100 Mb Ethernet that is actually a part of the USB 2.0 bus. Meaning it only supports a maximum speed of 100 Mbps (12.5 MB/s) which is horrendous when you’re trying to offload 60+ GB’s worth of movies and TV shows. This is only an issue when it comes to transferring files to and from the NAS, streaming isn’t (much) of an issue. To elaborate, on my first run of the NAS, I was able to stream four 1080p 60fps movies concurrently with no issues whatsoever. However, after I loaded a fifth, I began noticing periodical visual artifacts and some stuttering in each of the videos. I don’t exactly expect five people to be hitting this thing at once but this is still unacceptable for my tastes. I racked my brain and searched up to the 13th page of Google and wasn’t able to come up with anything. So finally, after admitting defeat, I decided to use my newly acquired RPi 3 as the NAS in hopes that the higher clocked 64-bit 1.2 GHz processor and on board Wi-Fi would alleviate my stress.

AawYa8T.png

 

3. Enter the Raspberry Pi 3

Well after setting everything up again, only half of my stress was gone. While connected to the (again 100 Mbps) Ethernet, I was actually able to stream thirteen 1080p 60fps movies at once with absolutely no sign of any visual artifacts whatsoever! Using the iftop utility on the RPi, we can see the network load was nowhere near the 100 Mbps maximum but was instead sitting at about 25% of that at 25-ish Mbps. This leads me to believe that I could potentially put on another 39 movies and watch them with no issues, as far as buffering and the network goes anyway. I’m sure the initial stuttering and visual artifacts were due to the weaker ARMv7 processor of the RPi2 and that I’ll probably only be able to squeeze another 7-9 concurrent streams out of the RPi 3.

 

Q2YLpKZ.png

 

So the processor and the Ethernet are no longer bottlenecks in streaming, but what about file transfer? Well file transfer speeds are still entirely disappointing at ~11.5 MB/s PC to Pi and ~9 MB/s Pi to PC. The Ethernet was clearly to blame here so I turned my attention to the Wi-Fi but it produced even worse results! I was only ever able to achieve a maximum speed of 3.5 MB/s both ways and only a 5.5 MB/s max speed when I put the Pi directly next to the router. So Wi-Fi is useless. After some digging around, I happened upon this article which detailed how you could achieve gigabit network speeds using a USB 3.0 to Ethernet adapter. Now the title is a little bit misleading as it states gigabit (1000 Mbps/125 MB/s) speeds however that’s impossible over the RPi’s max 480 Mbps (60 MB/s) USB bus. Nonetheless, it still looks like it will provide a boost in performance and I will definitely be trying it out as soon as mine comes in!

 

4. Modifications

In the meantime, I decided to play around with the RPi 3 to make it a little more overkill for my purposes. For starters, I disabled the onboard governor so that it runs at a constant 1.2 GHz and delivers the best performance possible at all times. Considering the minute power requirements of the RPi, I highly doubt this would cost me any more than $10/year to run 24/7 even with the processor constantly at 1.2 GHz. Next, I disabled loading of the X Server (desktop interface of the Raspbian OS) and dropped the GPU RAM down to 64 MB’s as I’m only going to be using this as a headless server. Next, I disabled some of the modules I won’t be using such as SPI, I2C, and camera modules to make sure the processor is only focused on serving data and not on unnecessary things. Next, I overclocked the SD card reader to 100 MHz, a 50 MHz boost over the default 50 MHz. This is supposed to give you better performance on regular I/O operations and general usage however I haven’t noticed much of an improvement myself due to me not even pushing the Pi much. Then, I disabled the Bluetooth and Wi-Fi, again to free up the processor as much as possible as well as to lower the power consumption by a bit. Finally, I lowered the default temp limit from 85°C to 70°C. This was a pretty unnecessary change as it will more than likely never heat up past 50°C whilst using it as a stream box. Moreover, I sort of Frankensteined a massive heat sink so even at 100% utilization of all four cores, it NEVER pushes past 56°C. :D To do all of this, I had to modify some of the config files which, thanks to the extensive documentation available online, was no hassle at all.

/boot/config.txt

# Disable onboard governor
force_turbo=1
# Disable X Server (Desktop)
start_x=0
# Lower GPU RAM to 64 MB's
gpu_mem=64
# Disable SPI Module
dtparam=spi=off
# Disable I2C Module
dtparam=i2c_arm=off
# Overclock SD card reader to 100 MHz
dtoverlay=sdhost,overclock_50=100
# Disable Bluetooth
dtoverlay=pi3-disable-bt-overlay
# Lower temp limit
temp_limit=70

/etc/modprobe.d/raspi-blacklist.conf

# Disable Wi-Fi
blacklist brcmfmac
blacklist brcmutil

 

Massive south bridge heat sink from an old motherboard I had lying around. I actually had to Dremel out one of the corners so it would sit flat on the CPU and not touch the power components.

6TsiRgg.png

 

5. Upgrading the Network Speed

Alright, so after getting my USB to Ethernet adapter I was effectively able to more than double my connection speed! In a synthetic benchmark that is... Iperf reports an average of 219 Mbps which is a significant improvement over the 93 Mbps I was getting before. Real world transfers aren't as big of an improvement however. I did see a doubling of file transfer speeds however I should note that the PC to Pi speeds did lower to around 15 MB/s after it hit around 20% of the transfer. While the speed still isn't as fast as I'd like it to be (I would prefer at least 40-50 MB/s), it's a nice improvement and it's a little more bearable over the original 10 MB/s I was getting before. I might look into something like linking the Wi-Fi and USB Ethernet together to get a little speed boost but I have no idea if that's even possible. As far as installation goes, it was simple as all I had to do was add the interface into the configuration file and I was off to the races.

 

/etc/network/interfaces

# Add USB to Ethernet adapter interface
iface eth1 inet manual

iperf Results

WXuLWqJ.png

 

Real World Test (Left: Pi to PC | Right: PC to Pi)

3IUlOKz.png

 

All in all, I'm happy I at least got some boost and didn't just waste my money for absolutely nothing :P

 

6. Additional Functionality

I'll soon be adding functionality to my NAS for BitTorrent and possibly a remote web based management service!

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/
Share on other sites

Link to post
Share on other sites

Power consumption of the your computer and drive is minimal .... also is another NAS... I dont see any increase of power bill running a Custom FreeNAS 24/7. The CPU in Pi might not be enough if you gonna run plugin or more drives.... Noise? place the NAS into a cardboard or another room, get A SSD as scratch disk.  

Magical Pineapples


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7731498
Share on other sites

Link to post
Share on other sites

Your build log looks really interesting so far! :)

 

I'm thinking of using my Raspberry Pi 2 Model B as a NAS as well, as right now I have an external HDD hooked up to my router, and it can barely handle two clients hitting it with file transfers at once and it drops out all the time. As you've mentioned, I worry about the transfer speeds of the Pi, but seeing that you're going to experiment with a USB 3.0 to Ethernet adapter, I'm really interested to see what the results are.

 

Good luck!

I actually couldn't underclock my 5 year old GPU to make it as slow as a next-gen console.

#pcmasterraceproblems

~Slick

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7731517
Share on other sites

Link to post
Share on other sites

6 minutes ago, MrUnknownEMC said:

Power consumption of the your computer and drive is minimal .... also is another NAS... I dont see any increase of power bill running a Custom FreeNAS 24/7.

Running a computer 24/7 does add up over time, even if it consumes a relatively small amount of power for a computer. However, compared to a Raspberry Pi, a custom NAS will consume much more power. The power consumption of the Pi is almost negligible, as it only consumes a few watts of power. Since OP doesn't want to spend lots of money on electricity, this solution makes a lot of sense for his use case.

I actually couldn't underclock my 5 year old GPU to make it as slow as a next-gen console.

#pcmasterraceproblems

~Slick

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7731523
Share on other sites

Link to post
Share on other sites

14 minutes ago, MrUnknownEMC said:

Power consumption of the your computer and drive is minimal .... also is another NAS... I dont see any increase of power bill running a Custom FreeNAS 24/7. The CPU in Pi might not be enough if you gonna run plugin or more drives.... Noise? place the NAS into a cardboard or another room, get A SSD as scratch disk.  

 

7 minutes ago, failblox said:

Running a computer 24/7 does add up over time, even if it consumes a relatively small amount of power for a computer. However, compared to a Raspberry Pi, a custom NAS will consume much more power. The power consumption of the Pi is almost negligible, as it only consumes a few watts of power. Since OP doesn't want to spend lots of money on electricity, this solution makes a lot of sense for his use case.

Exactly what failblox said.  While I'm sure I could definitely find some crazy power efficient PC components for a custom built NAS, they can't compare to the power consumption of a Raspberry Pi. Also, I personally really like tinkering as well! So while a custom built NAS would be fun to put together, the fun would only last so long as it's pretty easy to set one up nowadays. Using an RPi is a little more involved as it wasn't exactly meant for this purpose and it'll just make the fun last longer ^_^

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7731559
Share on other sites

Link to post
Share on other sites

16 minutes ago, failblox said:

Your build log looks really interesting so far! :)

 

I'm thinking of using my Raspberry Pi 2 Model B as a NAS as well, as right now I have an external HDD hooked up to my router, and it can barely handle two clients hitting it with file transfers at once and it drops out all the time. As you've mentioned, I worry about the transfer speeds of the Pi, but seeing that you're going to experiment with a USB 3.0 to Ethernet adapter, I'm really interested to see what the results are.

 

Good luck!

Well if you're gonna use an RPi 2, I'd recommend first overclocking it like so:

force_turbo=1
temo_limit=70
arm_freq=1000
core_freq=500
sdram_frew=500
overvolt=6

That's what I used to be able to get four concurrent clients with no issues. Past that, it becomes an issues with the CPU and at that point, I'd recommend an upgrade to the RPi 3. And thank you!

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7731574
Share on other sites

Link to post
Share on other sites

2 minutes ago, SirAhmix said:

Well if you're gonna use an RPi 2, I'd recommend first overclocking it like so:


force_turbo=1
temo_limit=70
arm_freq=1000
core_freq=500
sdram_frew=500
overvolt=6

That's what I used to be able to get four concurrent clients with no issues. Past that, it becomes an issues with the CPU and at that point, I'd recommend an upgrade to the RPi 3. And thank you!

How safe is it to overvolt the RPi? I'm looking at /boot/config.txt and I have all the same frequencies as you, but I have this value for overvolting:

over_voltage=2

Is my Pi just better at OC'ing than yours? Or am I not unlocking the full potential of my Pi?

I actually couldn't underclock my 5 year old GPU to make it as slow as a next-gen console.

#pcmasterraceproblems

~Slick

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7731585
Share on other sites

Link to post
Share on other sites

21 hours ago, failblox said:

How safe is it to overvolt the RPi? I'm looking at /boot/config.txt and I have all the same frequencies as you, but I have this value for overvolting:


over_voltage=2

Is my Pi just better at OC'ing than yours? Or am I not unlocking the full potential of my Pi?

The overclock settings people use seem to vary when it comes to the overvolting. Some will tell you to set the overvolt to 2 and others to 6. I personally have always set the it to 6 and have never had any issues with it when it came to heat or stability but if your Pi is stable at an overvolt of 2, then by all means, stick with it! More energy savings for you! :D

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7736176
Share on other sites

Link to post
Share on other sites

1 hour ago, nmil said:

Instead of using flash drives, I'm pretty sure wd has a hard drive designed just for the pi. I saw it on youtube a while ago, can't remember the name.

Yeah I'm considering using a few 1 TB PiDrives but I'm holding off on it for now until I can figure out just how much power it draws and how many I can stick onto the Pi before I need a powered USB hub. If the flash drives are any indication, I can only plug in two before I get low power warnings. If I do go the PiDrive route (which I most likely will) I'll probably ending up designing my own case for the NAS as well. So we'll see!

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7738774
Share on other sites

Link to post
Share on other sites

3 minutes ago, Lehti said:

Uhm... Why are you connecting a USB 3 to Ethernet adapter to the Pi? Even if it's the only USB device attached to the Pi (and it won't be) it will cap at 480 MB/s theoretical, but actual speeds will be lower than that.

I wish it would cap out at 480 MB/s :P jk

 

The reason is because the only gigabit Ethernet to USB adapters I was able to find were USB 3.0 and the USB 2.0 ones were all 10/100 Ethernet adapters. So even if I used a USB 2.0 to Ethernet adapter, I'd just be bottlenecking my self again with the 10/100 Ethernet. I'm well aware I won't be getting gigabit speeds over the Pi's max theoretical 480 Mbps (60 MB/s) USB 2.0 bus but I'm counting on at least around 30-40 MB/s. It would certainly be an improvement over the 10 MB/s I'm getting now lol

8 minutes ago, KuJoe said:

Why not get an Orange Pi Plus or Banana Pi Pro? They both come with 1Gbps ports and SATA connectors. The Banana Pi is depressingly slow but for a NAS it definitely beats the RPi3.

It has definitely crossed my mind especially because of the SATA connectors but to make things easier for myself in terms of wait time, I just went wit the Pi cause I already had it. And if I'm being honest with myself, I probably wouldn't go with the Banana Pi or the Orange Pi due to a little bit of fanboyism I have with the Raspberry Pi lol

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7738836
Share on other sites

Link to post
Share on other sites

4 minutes ago, SirAhmix said:

The reason is because the only gigabit Ethernet to USB adapters I was able to find were USB 3.0 and the USB 2.0 ones were all 10/100 Ethernet adapters. So even if I used a USB 2.0 to Ethernet adapter, I'd just be bottlenecking my self again with the 10/100 Ethernet. I'm well aware I won't be getting gigabit speeds over the Pi's max theoretical 480 Mbps (60 MB/s) USB 2.0 bus but I'm counting on at least around 30-40 MB/s. It would certainly be an improvement over the 10 MB/s I'm getting now lol

You'll get around 15-20 assuming a single USB drive and a USB to Ethernet converter without connecting the onboard Ethernet too, which is a neat improvement but won't make it dramatically faster.

You see, in your planned configuration the two devices will share the same controller and, as such, the same bandwidth, so they'll get a even 240 Mbps theoretical speed. Still, a neat experiment. Keep up with the good work!

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7738869
Share on other sites

Link to post
Share on other sites

58 minutes ago, Lehti said:

You'll get around 15-20 assuming a single USB drive and a USB to Ethernet converter without connecting the onboard Ethernet too, which is a neat improvement but won't make it dramatically faster.

You see, in your planned configuration the two devices will share the same controller and, as such, the same bandwidth, so they'll get a even 240 Mbps theoretical speed. Still, a neat experiment. Keep up with the good work!

Yeah, I figured as much. Oh well, the adapter comes in tomorrow so I'll experiment with it and see what speeds I can pull out of it in read and write operations. And thank you!

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7739191
Share on other sites

Link to post
Share on other sites

Don't misunderstand me, the Pi is a formidable piece of hardware considered its price and it'll give you plenty of hours of enjoyment whether you'll use it to learn programming, as a multimedia reader, a small server or even robotics projects, but I wouldn't use it to do full system backups or the like, because that'll take incredible amounts of time.

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7739218
Share on other sites

Link to post
Share on other sites

3 minutes ago, Lehti said:

Don't misunderstand me, the Pi is a formidable piece of hardware considered its price and it'll give you plenty of hours of enjoyment whether you'll use it to learn programming, as a multimedia reader, a small server or even robotics projects, but I wouldn't use it to do full system backups or the like, because that'll take incredible amounts of time.

Oh yeah, no worries. But either way, this isn't going to be something that I'm constantly accessing or constantly pushing to its limits. Like I'll mainly use it as a place to dump old school files and various other documents that I may need in the future but more than likely won't. Nothing mission critical, you know? Also, since I am planning on going into IT after college, this is a good opportunity for a learning experience!

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7739268
Share on other sites

Link to post
Share on other sites

As soon as I saw "Table of Contents" I was all tl;dr...more pictures, less text plz. I'm a primitive! :P 

"Solus" (2015) - CPU: i7-4790k | GPU: MSI GTX 970 | Mobo: Asus Z97-A | Ram: 16GB (2x8) G.Skill Ripjaws X Series | PSU: EVGA G2 750W 80+ Gold | CaseFractal Design Define R4

Next Build: "Tyrion" (TBA)

Link to comment
https://linustechtips.com/topic/594717-my-raspberry-pi-nas-wip/#findComment-7740088
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×