Story of how I turned my raspberry pi into a File & Media Server with Network-wide ad-blocking service 🤯
Motivation 🤔
To be completely honest, the motivation for this project essentially came from me not wanting to pay extra for additional cloud storage. Considering the subscription models from Google, Amazon, Apple, etc is not too bad in terms of reliability, it is still expensive for my personal use case. Usually, I carry a USB hard drive with me so that I wouldn’t necessarily need a network connection to access important data i.e. Documents, Old Cartoons, My Movie Collection, and Backups. But as the world moves forward and I invest (waste) some more money in modern devices, I want my setup to be wireless.
The more devices you own, the more you have to be careful about not leaving stuff behind. After a while, I got tired of it and I started looking for another bunch of USB HDDs that I can get so that I wouldn’t have to unplug it from my TV and remember to take it with me wherever I go. The price of a new external HDD isn’t too bad but then I ran into another hurdle, keeping data consistent across all the drives. That’s probably when I decided to calculate the cost for a DIY Network Attached Storage. Turns out if you already have a portable device that can run any version on Linux, you have a chance to set up DIY network storage at a cheap cost.
Since I already had a Raspberry Pi 3B+ running on my network as an Ad-Blocking Server, the task became easier than I thought. I started by whiteboarding ideas about how I can make this system more scalable and easy to debug rather than just installing a bunch of packages and troubleshooting when I run into an error.
Setting up docker containers seemed like the best way to go. The only thing I had to figure out is how I would manage them. Luckily OpenMediaVault comes with Portainer, an extension that allows you to install and manage docker containers.
Steps 🤓
- I started by formatting the SD card and resetting to the latest version of Raspbian.
- After updating all the default packages to the latest versions, I downloaded the latest version of OpenMediaVault.
- Now at this point, you can choose to set up File Sharing which is exactly what I did.
- I found a 3.5’ Seagate HDD 2TB for $30 at my local Microcenter.
- Along with that, I bought an externally powered SATA to USB 3 hub.
- After formatting it and re-partitioning it, the HDD showed up. Then I created a share and enabled SMB sharing. Voila! Network Drive immediately showed up.
- To log in as a user you can use your PI credentials or create a new user using the OMV interface.
- Setting up Portainer was as easy as clicking a button. Portainer also requires you to log in.
- Looking up docker images and following documentation was a breeze. The only thing that took more time was to set up a virtual network and configure it so that my ad-blocking server (PiHole) doesn’t mess with the current IP configuration. That’s when binding the IP for specific devices helped.
- Once the containers are up and running, I enabled DLNA sharing and woot! We are in business.
Now I can easily access my files and media from anywhere in my apartment regardless of what device it is as long as it is connected to the network. The end product looks like this!
Pros âś…
- Relatively Cheap
- Moderately Easy to setup
- Highly Scalable
- Decent bandwidth
- Runs on Local Network
- Low energy consumption
Cons ⚠️
- Capped network capacity due to basic onboard LAN controller
- Random reboots when multiple USB devices are connected
- Still an ARM-based device
Future Work 🔜
Even though the current setup works, it has its limitations. Like capped network bandwidth. The future work involves finding a way to disable the inbuilt network card and connecting the USB network adapter to see if it makes a difference. Stay tuned for future updates!
Update: This post was written about 2 months ago. I’ve been using this setup since then. Although I did observe occasional reboots from RPi it has worked as intended software-wise. Turns out it was a faulty power adapter. Replaced it and boom! Back to normal.
More in-depth information on installation: