Setting up a home server for file syncing

So if you're like me,  you don't want to pay someone like Dropbox to hold your data for a few reasons.
One reason is that they are simply expensive.   Another reason is that the data transfer isn't terribly fast,  and you aren't in control of your data.   Others can potentially get access, and private companies often even cooperate with authorities without even rewiring warrants.
Yet I have multiple computers I want to keep synchronized,  and I have a lot of important data I want to keep backed up.
I used to run my own server on an old Sun SPARC Station, but that was back in the days when static ip addresses where a given, running your own email server was a more reasonable proposition,  and the only free Web hosting sites were full of annoying and garish banner ads.   these days,  the reasons for running your own full fledged server are diminishing,  especially since you can spin up a server anytime with services like Linode and Digital Ocean.
I also used to have a quad core i7 Mac mini server,  but that is very much overkill for a file sync server!

I have been using both AeroFS and BitTorrent sync since they were in beta,  and although it mainly used AeroFS in the past,  I decided to switch to BTSynch entirely.  
I also have an apple time capsule which I used to use for backups ,  but it seems to have gotten slower over the years.   I am happy enough with the file synch history feature of BitTorrent sync,  but that means putting more files in the sync folder.

Another quirk of systems like BTSynch and AeroFS is that they require systems to be online at the same time in order to sync,  since they have no central server.   For example,  if you have a laptop you use during the day,  and one you use only at night, then they may never sync even though you use both every day.   you can get around this by having one or more machine that are always online,  or staggering the times when the machines are online.  
The question was: what should I use as an always on server?

Well I had the criteria :
1. It should be cheap
2. It shouldn't use much power
3. It should be reliable

Along with these,  it should be small,  quiet,  and run headless (without a monitor),  and restart reliable after a power outage or similar.

In short,  I didn't mind doing some "hacking" to set it up,  but once set up it should simply do its job without intervention.

The first thing I tried was a semi broken windows tablet I found on sale.   The battery wouldn't charge,  so it would only work while connected to a power source.   That was fine,  but it also happened to run Windows.  I didn't have any luck installing Linux on it,  and even reinstalling windows was a huge challenge.   The memory and flash storage weren't upgradable,  and the combination of turning on BitLocker encryption and installing BT Sync as a service seemed to be enough to bring it to a crawl. 
Once the power went out because I blew a breaker,  and that was enough to corrupt it so it wouldn't even boot anymore.   worse yet,  it wouldn't power on automatically.
So...  This was a really bad option, as was the whole concept of windows tablets to begin with.
So,  I went out searching for a suitable machine,  with the added requirement that it should have upgradable storage,  memory,  and a normal bios.
Not that non PC compatible systems were out of the running.   I actually considered the Honor Cube.  I gave up on this option because I wasn't able to find much information online about how the hard drive was presented to android apps, and it didn't look like there was going to be any new version of Android released for it any time soon. 
And that brings me to the last point,  I expected to use this box for at least five years, so although I was looking for a pretty low spec machine, I wanted it to have a little growing room.

I went on the hunt in Akihabara, and found other options, some of which were a bit too under weight.  

1. I found some kind of embedded computer modules with Atom chips, 512 MB RAM, and 2 GB of flash memory.  While these had USB, it may have been only USB 1.x, and 2 GB wasn't enough for the files I wanted to store.  512 MB is also cutting it close, as BTSync likes to use a fair amount of RAM.

2. I found a desktop version of the eee pc, which would have been fine, but it was too expensive to consider.

3. I found these "Beagle Quad" rack mount machines, with a core 2 duo processor, but no storage.  On the one hand, they looked very reliable, but on the other hand, they didn't look like they would be very friendly to my electricity bill.  Plus, without storage, I would need to set up a NAS... for my NAS.  (Update, it turns out these models can accept 2.5v SATA drives).

To be fair, let's take a moment to mention the things that were not on my list of requirements:
1. The ability to have more than 8 GB of memory.  Having 64 GB of RAM wouldn't make BTSync go any faster, and it's not likely any low end machine would support it anyway.
2. Wireless.  Wireless would be great, but I planned to plug the box into the network in my house.
3. The latest processor.  A medium speed Atom or Celeron would be fine.  (As would some kind of ARM processor, etc.)
4. Great graphics or sound.  In fact, I would have been okay with none at all, since I was just going to need the video for setting up the box the first time.   I could use serial instead if that would have worked.  
5. Bluetooth, etc.

Not finding anything to my liking, and then one day at lunch, I went into Bic Camera for something unrelated, and found the "BeeBox", a small PC about the size of an Apple TV, with 3 (!) monitor ports, USB3, and more.  The price was too much, but I searched on Amazon and found the barebones model with no OS, and in a few days it arrived:


I found some memory and an old SSD drive, and then downloaded a Linux installer into a USB memory stick.  I thought I was all ready to go when I realized that I had no actual computer monitor that could accept HDMI or VGA.  This was solved when I realized my TV would do the trick.  Theoretically, I could have done a network install, but I scrounged up a USB keyboard and mouse for the job.  

I installed the memory I found left over from upgrading a mac mini (interestingly, you have to put two identical modules or this model won't boot), and two SSD drives (one mSATA for the OS and one normal SATA for the data).  I hooked the HDMI up to the TV and booted the machine up.  I set up the BIOS to auto power-on after power loss, and proceeded to install Centos.
You need to know the IP Address to reliably SSH into a machine to tinker around, but setting up a static IP can be a pain later when you want to change it.  To work around this annoyance, I did two things:
1. I looked up the MAC address and registered it my router with a static IP Address.
2. I installed Avahi so that I should be able to use the hostname locally.
I installed and set up BTSync, and rebooted it with the monitor and keyboard unplugged just to make sure everything was working.

At first there were some minor issues with the time zone after rebooting, but I managed to fix those without too much trouble after a quick trip to Google.

As for the set-up itself, I test drove it first in DigitalOcean before even buying the server, and used the instructions here, with some minor modifications due to the fact that I was using Centos instead of Ubuntu.

I've been running this server for a few months now, and it works great.  It is a bit overkill in some ways perhaps, but it works and it works well.  It's small and unnoticeable, it uses very little power, and it's silent.  Since it doesn't have a hard drive and its not normally under heavy load, it barely even gets warm.  

1. Whenever I make a change on my laptop at home, the changes are immediately synchronized to the BeeBox.
2. Even if I turn all my machines (other) off, files can be synchronized (to my phone or laptop) when I am out and about 
3. Other people who I have shared files with can access and sync them any time.
4. If anyone shares files with me, they will be synchronized to my server immediately, and then synchronized to my laptop when I turn it on.

Sadly, though, there was still one thing missing.  I want this to be a back-up of my data, but it's in my house.  If my house burned down or something, I would lose all of my data.  (Okay, so perhaps an earthquake is more likely than a fire).  I have had computers die from lightning before too, even when plugged into surge suppressors.  And sometimes computers just die for no apparent reason.  Also, since I only want a partial sync to most of my devices, this machine would be the only full copy of all of my data.  It should have a backup.  Ideally, I should have two of them, and one off-site.

Well the off-site part is easy enough.  I asked one of my friends if I could give her  a little box like this to plug in at her house and she said "year sure of course."  But the thing is, I didn't really need a fancy box with USB 3 and 3 monitor ports and SSD.  A cheaper hard drive based box with a bit lower specs would work just fine as a secondary machine.  If I could find a used machine, that would save me even more money.  

So I went back to Akihabara to see how cheap of a machine I could find that would still fit the bill.  This time I was in luck, and I found the following at a store called PCNET:


The Epson Endeavor, for around $40 USD.  (Update: They lowered the price to around $30 now).  I have seen these things in use at city hall, etc.  They are a bit thinner and wider than the BeeBox - about the size of a piece of bread.    They are usually bolted directly onto the back of an LCD monitor, and presumably provide just enough processing power to run Windows and allow the office workers to use Word and a web browser and whatever custom apps they have.  Unlike the BeeBox, which is designed to drive multiple 4k displays, this thing can barely handle 2D graphics, but it should work fine for file syncing.

I cracked open the box to find two surprises:
1. The word "Pegatron" stenciled onto the circuit board.  I can only assume that is a code name.  (Update: Apparently, this is the name of an OEM maker).  
2. Despite this model being described as fanless online, the one I bought has a fan.

Windows XP just wasn't happening, yet this unit has only a VGA out for video, and I don't happen to have any VGA monitors or even a VGA cable, so I took out the hard drive, installed Linux (Ubuntu server from here, this time) on it using VMWare, and put it back in the machine in order to get it to boot up.

After swapping in the hard disk, the machine would boot up (as indicated by the hard drive at least), but never appeared on the network.

I bought a cheap VGA cable which I hooked to the TV to investigate the situation.  It turns out that the Ethernet identifier had changed from ens33 (in vmware) to enp2s0 for the actual machine.  Since the settings in /etc/network/interfaces were set automatically by the installer but don't get updated automatically, the network didn't work until I edited the file appropriately.  Once I did, it spring to life, and I used the new BitTorrent official repository to install and configure the BitTorrent client.  The only minor issue was that it didn't start automatically upon reboot, which I fixed pretty easily.
Now that everything is up and running, the only thing I find I don't like about the Epson Endeavor for my purposes is that it is very easy to accidentally press the power button and shut it down when moving it, etc.  


BitTorrent Sync displaying connected devices:
 Syncing to the new node in progress:



Comments

Popular Posts