23. August 2020 14:17
Last week I had a bit of free time (which is very rare these days), and decided it is finally time to build a file server to be used for backing up my laptops (both Mac and PC), and also as a general purpose shared drive. After doing some research I learned Apple supports SMB protocol for Time Machine, and SMB is obviously compatible with Windows as well.
My criteria to select the hardware was simple:
- Gigabit Ethernet
- USB 3
- Support for Ubuntu
I decided to go with Raspberry Pi 4 as it satisfies my criteria. Since I wanted a sturdy case and power supply, plus a micro SD card for the OS, I ordered the Vilros Raspberry Pi 4 Complete Starter Kit with Fan-Cooled Heavy-Duty Aluminum Alloy Case (2GB, Black). At $85 + tax, this kit had everything I needed. This picture shows the finished project connected to a Seagate Backup Plus 5TB Portable Hard Drive which I got from Costco for $90 + tax.
I chose Ubuntu 20.04 as it has strong support for Raspberry Pi 4 and I felt it may have better performance for what I'm trying to do. The process of installing Ubuntu was very simple. What took me a bit of time was to configure SMB and test performance and then compare with NAS to see if NAS would give me faster file transfer.
I used following guides to get me started:
Since SMB V3 supposedly performs better than NFS and AFP and my testing with NFS did not show faster file copy performance, I ended up sticking with SMB. I used Blackmagic Disk Speed Test as my benchmark and best I could get is close to 40 MB/s for both read and write, while both my Mac laptop running the benchmark and Raspberry Pi had wired connection to the same Gigabit switch. This speed is a bit disappointing as "hdparm" tool running on Pi shows around 113 MB/s read speed and "dd" command shows 55 MB/s write speed. I would love to know how my SMB read/write performance can be improved.
At the end of the day, it worked out okay. I spent close to $200 and got 5 TB of network storage which I'm sharing between my Mac, Windows and Linux machines. I already had a 2 TB USB 3 external drive which I was able to hook into my Pi file server and make the total storage size 7 TB.