Summary
An inexpensive, high capacity, offsite backup server that you can stick just about anywhere and access from home. Rsync can be used to synchronize with a local system, and rsnapshot can provide snapshot capability. The server is built with an Orange Pi PC board which provides plenty of CPU power for a backup server while using little power and costing even less than a raspberry pi.
Concept
For several years I used Amazon S3 as an offsite backup system for my home file server. In my home, each PC backs up to the local file server which then does a periodic sync with the offsite system. As my backups grew larger, Amazon S3 stopped being a good fit due to the per gigabyte-month cost. At that point the cost of 1TB storage VPS had come down so I switched to that solution for about a year. I went through two different providers. I started with ByteOnSite which was great (doesn’t appear to be active right now), then switched to Time4VPS which was a bit cheaper still and worked fine. In the end though, I didn’t feel like paying for their higher capacity plans as my server grew beyond 1TB.
Circumstances with my Xenserver installation forced me to purchase a 4TB USB disk to perform some backup and restore operations which led to a eureka moment for me, why not run my own backup server with a Raspberry Pi!? I could stash the server at work where bandwidth is plentiful and my bosses are totally OK with this sort of arrangement since a few other guys run a server or two up here. Mine would actually be the lowest power and lowest resource usage of the bunch and utilize zero rack space. In the end I came up with the following.
Backup Server Hardware
- Orange Pi PC Kit from Aliexpress: $25 (With Shipping)
- Orange Pi PC
- Orange Pi Case
- USB Power Cable
- Orange Pi PC Heatsinks: $5
- 8GB Micro SD card: $7
- USB Power Adapter 2.4A: $6
- Wester Digital MyBook 4TB: $119
Total Hardware Cost: $162
I bought the heatsinks thinking that the Orange Pi was rebooting due to overheating under load. Further troubleshooting revealed that the issue was actually due to the 1A USB power supply I was using. If you are undertaking a similar build I would say that the heat sinks are definitely optional while the 2A or higher power supply is definitely required. The hard drive needs to be big enough to mirror your local content and any extra space can be used for snapshots. As with all hard drives, larger is better.
Backup Server Software
For software I wanted a standard Linux distribution and lucked out when I found Armbian. If I hadn’t found Armbian I wouldn’t have even bought the Orange Pi PC board because messing around with a proprietary kernel fork on my own sounds like the opposite of fun. Since Armbian supports pretty much all Debian packages I was able to build my backup server with pretty basic tools such as rsync over SSH and OpenVPN.
I utilized NTFS-3G for access to the NTFS formatted USB hard disk. The reason I chose NTFS format for the hard disk was to allow for quicker access to the disk in a restore scenario. NTFS-3G provides read-write access to NTFS disks while built in kernel drivers generally only allow for safe read access.
The only exotic thing I did was to use an OpenVPN tunnel established by the server to my firewall to access the Orange Pi from my home network. Rsnapshot is used to do snapshots for now, but I am concerned that growing utilization will ultimately force me to go back to a pure mirror without snapshot capability.
The current Armbian build for the Orange Pi PC can be found here. My server is based on an older Debian based build. Debian based builds can be found in the Armbian Archive.
Configuration
First, I installed Armbian on the card. You can follow the detailed directions here. If things haven’t changed a 4GB card would also suffice.
Then, I installed and configured NTFS-3G in Armbian.
apt-get install ntfs-3g
Then I added my USB drive to fstab to mounted on boot. After editing my /etc/fstab looks like the following:
LABEL=4TB-USB /media/4tb ntfs-3g defaults 0 0
The LABEL tag corresponds to the NTFS colume label.
The OpenVPN tunnel back to my home network was established as discussed in this previous post.
Syncing from home server to the backup server is handled with rsync. If you don’t have a bandwidth cap you would be wise set a cron job to run the rsync to offsite weekly. Since I have a data cap I still handle the sync manually to make sure I don’t go over my bandwidth cap.
Rsnapshot is run on the backup server and maintains a 1 week and 1 month snapshot. My disk usage is growing so I may not be able to keep snapshots indefinitely without moving to a larger drive.
Results
I can say after about a year that I love my Orange Pi backup server and have had zero issues with it. The VPN has been stable and always re-establishes without issue. The Orange Pi itself is rock solid and has never had any freezes or reboots since I gave it the power supply it needs. The only real issue is that my Internet has a monthly cap so I have to be careful not to run a full sync if Internet usage has been high.
NTFS on linux is a huge performance penalty. Just compare by yourself with extX. As for VPN hardware crypto for H3 arms is also somewhat WIP…
Yeah, the whole setup is performance limited by those factors, but during normal backup tasks CPU is below 50% and reads and writes are limited more by USB than the file system. All things considered, I am fine with the performance trade offs.