Home Server Part 2: Tips & Economics
Last time I discussed about setting up my own BitTorrent Sync servers. Now that they have been running for a while (and I have reinstalled them a few times...), let's look back.
First, let's compare the two machines I bought:
First, let's compare the two machines I bought:
ASRock Beebox vs. Epson Endeavor
- Internal Storage: The Beebox has m.SATA and normal SATA, so it can handle only one drive - though they suggest SSD only. The Endeavor has only a single internal drive slot, though it comes with a 160GB HDD.
- External Storage: The Beebox has USB 3 and USB-C connectors. The Endeavor has only USB 2, which is fine for plugging in a keyboard for set up or a USB memory card for installation - but not so hot for large storage media. While speed is not so important in day to day operations, it will suddenly be important if your laptop dies and you want to re-sync everything.
- Video: The Beebox has several video out ports. The Endeavor has only a single VGA port.
- Power Button: The power button on the Beebox is recessed and you are unlikely to press it by accident. The power button on the Endeaver is very easy to press by accident.
- Memory: The Beebox takes DDR3 memory (2 cards), while the Endeavor takes DDR2 memory (only 1 card). It is difficult to find even 2 GB DDR2 cards, much less 4GB ones. This means that DDR2 memory actually can cost more than DDR3 memory. Luckily, BTSync seems to make due with only 1GB.
Updates and Look Back:
1. Local Networking: If you have several of these things in your house (or servers for other purposes), you really want to be able to find out what IP address they are on without statically assigning and memorizing them. Mac OS and Windows handle this by default (though OS X does a much better job than Windows...). In Linux, you need to install/enable the Avahi-daemon and Avahi-nss. This works perfectly for me in Ubuntu, but mysteriously stops working on Centos quite often. If you want to use this feature, I recommend Ubuntu.
2. BTSync Web Access: If you install the Linux version of BitTorrent Sync and want to set it up from the local web page, note that you can only connect from the localhost by default - but if you aren't installing any GUI (which you won't need...), then you have to use lynx or links to access 127.0.0.1. Yet, if you use one of those, you will get a message saying that BTSync is not set up properly when in fact it is. The easiest fix is to enable non-local connections (by editing the btsync confg. file in /etc to change the ip address to 0.0.0.0), and then restart the server and access the machine from another computer using Chrome or Safari. (If you haven't set up Avahi, you can always use the IP address). It seems self defeating to me that they made a web GUI and then limited it to the local machine, though this is probably for security reasons.
3. Data Directory and Admin Password: The btsync config. file lists a path in /usr, but that is where BTSync stores it's databases. The actual path to store files should be specified using the web GUI. Also, set your admin password while you are in there. If you don't set a password and someone finds your server's URL later, they could log in and share folders to themselves.
4. Service Setup: You may have to set BTSync to start up automatically at boot if it doesn't do so by default. My results in Ubuntu haven't been consistent on this point.
5. BIOS Settings: You should go into the BIOS and change the machine to boot up automatically in case of power loss. Depending on the machine, you may also have to disable errors in case of missing keyboard/mouse or monitor.
6. Headless Issues: Some machines won't even boot without a monitor, or may require special kernel options to do so. You can simply throw money at the problem by buying a "display emulator" dongle instead, though. You can disable external boot options and then create a setup password so nobody can change that. (In case you are deploying the server at an un-trusted site). (Note: Both the Endeavor and Beebox work fine without any monitor attached).
7. Time Zone Issues: I had problems with the clock in Centos being set incorrectly at boot. I eventually managed to correct it, but I didn't have this problem at all with Ubuntu.
8. Checking Status Remotely: Since BTSync works behind firewalls, you can give a router to your friend to store of-site and your files will still be synched. You won't be able to use the WebGUI or SSH in anymore, but you can check the sync status and how much drive space you have left from any of your BTSync clients.
9. Remote Admin Access: If you want to be able to connect into your little server after you have deployed it elsewhere, there are several options: 1. Chrome Remote Desktop (only requires Chrome to set up, but does require installing X window). 2. Hamachi VPN (easy to set up), 3. Reverse SSH tunnels to a Linux server with status IP you control. (Free but requires a server).
10. File-system Choices: I highly recommend using BTRFS instead of XFS or EXT4 simply because it has "bit rot" detection. All the sync and backup in the world won't help you if your files get corrupted on disk. Although you can convert EXT4 directly to BTRFS, you have to do it while the disk is unmounted. If you make your /home/ partition separate, then it should be easy to unmount it for conversion even while the system is up. (You can also format it as btrfs from the start). btrfs also supports snapshots, which could be used to recover deleted data. btrfs also supports block deduplication and file compression, both of which can save you space.
11. Encryption: To encrypt or not to encrypt? This is a difficult question. One option is to let BTSync handle the encryption by using the "encrypted" folder option, but encrypted folders are only encrypted when you share them with other people. If you use your own identity on your backup server nodes, then those folders will not be encrypted. If you use a separate identity, then new folders will not automatically be added. Another option is to encrypt the file system, but that means some kind of access if required to enter a password at boot-up (or later). I can't think of a perfect system at the moment.
12. Disk vs. SSD: How much space is enough? How fast is fast enough?
One of the great things about using btsync is that the sync generally happens in the background, so speed is simply not an issue most of the time. What's more, if you have multiple devices, then the speed will be improved. So an old hard disk or slow flash drive is perfectly find in most cases. If you use selective sync and click a placeholder file, then the file will download on demand, however the download is actually very fast in most cases. Though SSDs and flash memory have increased in capacity and decreased in price in recent years, there is still a trade off between size and cost. Right now for the same money, you can still buy a hard disk twice as large as an SSD you could buy for the same money. The main advantage of SSDs is that they are faster, and a secondary advantage is that they are shock resistant. Since we don't need a particularly fast or shock resistant drive for BTSync, it would seem that we would be happy with a hard disk so we can store more. On the other hand, SSDs use less generally electricity, create less heat, and are silent. So the question mainly comes down to one of budget. Either way, you can get at least 240 GB SSD or HDD for less than $100, and prices are still dropping. The good thing is that the running cost for your BTSync server will be about the same whether you choose 1TB or 100GB.
13. Economic Analysis
The 1TB case:
At current prices, Dropbox Pro costs 120,00 JPY (~$112 USD) per year for 1TB of storage if you pay up front. Right now, you can find a new 2.5inch 1TB drive on Amazon for 5990 JPY (~$56 USD). Combine that with the Epson Endeavor NP-11 I bought for 2,990 (~$28) and you have a total of 8980 (~$84) JPY.
We are assuming you already have internet access, and leaving that out. (You would need it for Dropbox anyway).
Electricity is expensive in Japan any anyway we want to be "eco", so we'll include that in our analysis.
Epson claims that the Endeavor uses 14 Watts during "normal use". It should use much less when idle, but we'll assume it is using 14 watts all the time, 24 hours a day, 365 days per year., which works out to about 122 Kwh per year. At a price of 20 JPY per Kwh, that works out to a little less than 2500 JPY per year.
Add that in, and you have a first year running cost of: 11,432 JPY. ($106.77)
Strangely, we actually pay over 500 JPY less to own our own infrastructure. For any year afterwards, we save more like $75.
But, we have some benefits and drawbacks compared to Dropbox:
Pros:
1. Sync speed - BTSync is faster in general, and is much faster if you have a local mirror.
2. Enhanced privacy & Security - Nobody can spy on your data.
3. Enhanced flexibility - You can use the server for other things, add more space, etc.
Cons:
1. No web links - We don't get to share via the web without installing any software. (Our recipient needs to install BTSync).
2. All On Site: We don't get off-site backup safety. If your equipment gets fried by lightning, it may fry both your main PC and your sync server.
Mitigation of the cons:
#1 Web links can be provided by simply using a service like Dropbox within the free limit.. Another option is to set up a web server, and simply have BTSync sync a public folder into the public_html folder of the server.
#2 We can get off-site backup safety by using a VPS (cheap) or putting our own server at a friend's house. (Free)
This would double the investment cost, but we would still break-even with Dropbox in less than two years.
The 100GB Case
Dropbox doesn't offer a 100GB plan currently, but Google offers 100GB of space on Google Drive for $1.99 USD per month, or about 2,556 JPY per year. Since the Endeavor includes a 160GB drive, you would only pay 2990 for the base unit. Even ignoring electricity costs, it would take you over a year to break even with Google's price - and if you include electricity costs, it would take 2 years or more (depending on how much the actual cost turns out to be).
On the other hand, you would have much better speed than Google, and control of your own servers.
Clearly, on an economic basis along, for 100GB, there is no compelling benefit to DIY.
The 2TB Case
Amazon Japan currently sells 2TB "NAS" drives for 9,980 JPY. This would bring the total initial cost of the Endeavor to 15,422 JPY, including electricity.
Neither Google nor Dropbox seem to offer 2TB plans at the moment, however if you double the price of Google's current plan at current rates, you get 25,670 JPY. That means that you easily save money by doing it yourself, just in the first year. By the end of second year, you could have bought three of your own nodes.
More than 2TB
Clearly, within reason, the more space you are considering, the more attractive the DIY option becomes. If many many people are accessing your content constantly, then you would need a dedicated server on an internet link designed for that kind of traffic - so BTSync from your home internet may not be appropriate - but then Google Drive and Dropbox would probably also block you if you have that kind of traffic.
Note about network limits:
At least OCN in Japan supposedly has a "soft limit" of 25GB upstream per day. (after which they start sending you nasty warning letters). Syncing a hard disk with several terabytes would obviously easily exceed that on a 1Gbps fiber link like the kind that NTT offers. One solution would be to simply limit the transfer speed in BTSync. A better solution is to sync your drives first before placing them off-site.
Hacks
There are a few things you can do to reduce your costs even below what we have projected above.
1. Sometimes on Server - There is nothing to say your server needs to be on 24/7. You can, for example, turn it on only certain hours per day. You can schedule shutdown by cron jobs, and power-on using the BIOS for most machines. There are three ways I can see this paying out:
Waking hours only: You set the server to boot up an hour before you usually wake up. It will download any files it needs and be on, synched and ready for whenever you need it to be. You set it to shut down (or sleep) an hour or so after you usually go to sleep. The main benefit here is you can probably cut out at least a 3rd of your electric bill.
Daily Sync only: If you are mainly using the server just as a back-up, you can set it to turn on once per day, run for an hour or so to sync any changes, and then shut down. This means you won't gain any enhanced speed for partial sync, but you will get an up to date back-up assuming your other machines are on.
On-demand. You can turn on the server only when you want to access the files. BTSync is also smart enough to recognize when a folder is disconnected. That means you could have a small energy efficient server hooked to a bunch of big power hungry USB drives, and turn on the drives only when you want to access them.
2. Used drives - The hard drive upgrades we listed above assume you purchase new drives for your upgrades, but there is nothing wrong with upgrading your hard drive using a second hand model. It happens quite often that people upgrade their hard disks, and sell the old ones to a shop second hand. The shop then marks it up and sells it again. Thus, one can easily find hard drives at half price. Even if the reliability is actually lower (doubtful), that's okay for our use, since we are basically mirroring data we already have somewhere else.
3. Sync Pro and other products
We have discussed BitTorrent Sync exclusively, but other products do exist.
Sync Pro - The first is the "pro" version of BTSync. Using the Pro version allows you to change the security of shared folder on the fly, but more importantly, so have access to selective sync and have new folders automatically added to each machine. With selective sync, you can keep all the files on your "server", while they download to your laptop only when you try to open them. This means that as long as you have at least two servers (one for backup and one for main), you can delete files from your laptop to save space and still have at least two copied of your data.
AeroFS - AeroFS is another interesting solution. The main limitation is that you have to run your own authorization server, which has to be accessible by a public IP if you want to access it from outside. You could use a VPS for this if needed. Secondly, as with BTSync, your friends will have to install the client in order to access the files. In addition, the client they install will only work with your server, so they can't (for example) access your "cloud" and also someone else's. This is okay for AeroFS's target audience (corporate use).
4. Embedded operating systems - I used standard Centos and Ubuntu server for my experiments, but given the appliance like use, you could easily install a more bare bones system. Ubuntu's IoT builds would likely be more appropriate. (In fact, many NAS devices support BTSync natively now).
Comments
Post a Comment