My Self-Hosted Cloud Storage with Seafile and Tailscale is Already Cheaper Than Dropbox or Google Drive!

| Comments

Back in February, I decided it was time to go back to hosting my own cloud storage again. I originally started hosting my own Seafile server back in 2013. I stopped colocating that server hardware in 2018, shut down my old Seafile server, and I wound up paying another company to use their Seafile service.

There were two problems sneaking up on me this year. I was rapidly approaching the storage limits of my hosting provider, and there was a huge chunk of my video data that I wasn’t syncing, because I didn’t have anywhere near enough space available.

In February, I took inventory of my total storage requirements. If my memory is correct, I was using right around 3.2 TB. The options for syncing that much data to a Dropbox-style are all rather costly. Dropbox was $120 per year for 2 TB of storage, and Google Drive was $100 for the same. That would have made my annual bill either $200 or $240.

NOTE: Google Drive sync only works with third-party clients. It would be more accurate for me to compare my costs to Dropbox, since that is the service I would actually use instead of Seafile. I’m OK with comparing to Google Drive pricing, though, because their prices are lower, and that makes things more of a challenge on my end!

I decided to spend about $290 for a Raspberry Pi 4 and a 14 TB Seagate USB hard drive. I dropped it off at Brian Moses’s house, and it has been chugging along without much trouble for the past 10 months.

I expected to save money, but I didn’t expect it to happen so soon!

In fact, I completely missed the point where I crossed into the black. I just had it in my head that if I had gone with Google Drive, I would have paid $200 back in February, and then I’d be having to pay another $200 after the first year was over. I knew that once I made it to February 2022, I would have paid back my initial investment and been ahead by about $110.

I forgot to take into account the fact that my data is growing. I checked earlier this month, and my Raspberry Pi’s hard drive is 41% full. That’s just over five terabytes.

Saefile Raspberry Pi Storage

NOTE: I did a bit of housekeeping and garbage collection while writing this post, but I’m still over 4 TB!

I imagine I flew past the 4 TB mark during the summer. If I were using Google Drive, I would have gotten a warning that I was running out of space, and I would have had to do some work to pay for more storage.

This means I’ve already paid for my Raspberry Pi and 14 TB hard drive, and I’ve even managed to put about $10 in my pocket!

You can’t really buy 6 TB of storage on Google Drive

At least, I don’t think you can. Even if you want to spend $300 per year on storage, they won’t let you put that much data on a single account. I’m pretty sure you’d have to do something goofy like set up three separate accounts. That would be yucky.

A Dropbox business plan supposedly has unlimited data, but they charge $20 per month per user, and there is a three user minimum. That’s $720 per year. If you have two friends, and you need to store a boatload of sync a boatload of data, that might be a good deal. It isn’t a good fit for me. I don’t have dozens of terabytes of data to sync!

Using Google Drive as my pricing benchmark seems like a good compromise. Google’s sync client isn’t great, and they don’t support Linux. Dropbox’s sync client is excellent, and it does work on Linux, but I feel like using their pricing makes my setup seem like too good a value. There are cheaper services from smaller companies, but they aren’t all that much cheaper.

Why am I using Seafile?

My Seafile server’s job is to synchronize my files. That’s just about the only feature I truly expect out of the software or rely on.

It pushes copies of every change I make to my desktop, laptop, and NAS. If this is your goal, Seafile isn’t the only game in town. Syncthing does this job very well, and is a much simpler piece of software. The last time I tested Nextcloud, it wasn’t up to the task of syncing my quantity of files, but that was 9 years ago. I expect their situation has improved tremendously in the mean time!

The Seafile client encrypts my data locally. The server doesn’t have the keys to access my files. This is extremely important to me. This keeps me safe if anyone on the Internet manages to hack into my Raspberry Pi. Nextcloud might be able to do this now, but I don’t believe Syncthing is up to the job yet.

Seafile also keeps historical copies of all my files. I have most of my Seafile libraries set to keep three months of history. A new version of every file is recorded just about every time I hit save. There are probably already 18 revisions of this blog post on my server already.

Seafile is at the heart of my backup and disaster recovery plan

The first thing my backup plan attempts to mitigate is hardware failure. Seafile doesn’t sync changes instantly, but it isn’t far off. I can save a file on my desktop, and the update will usually show up on my laptop in about 30 seconds. If I have that file open in Emacs on both machines, it will even automatically refresh itself.

If the SSD in my desktop melted right now, I could walk across my office, open up my laptop, and pick up where I was a couple of minutes ago. Nearly instantaneous backups are absolutely amazing.

My Seafile Libraries in December 2021

The next disaster I am defending against is the natural kind. What if my home office floods? What if my house burns down? What if there’s a burglar?!

If I’m lucky, I get to walk out the door with my laptop. If I can’t, there will be a full copy of all my data six miles away on my Seafile server. It would be nice to have more distance between me and my off-site backup, but I’m willing to live with this.

The last problem boils down to software failure. What if my new Emacs extensions decides to write garbage into all my Markdown files? What if I accidentally delete my home directory? What if I get hit with ransomware that encrypts then deletes all my important files?

The bummer here is that this change will be happily synced to all my computers. The good news is that history will still exist on the Seafile Pi. It’ll take a good number of clicks, but it won’t be too much trouble to restore.

My implementation of a 3-2-1 backup

What is 3-2-1 backup? It means you should have at least three copies of your data. Your data should be on at least two different mediums. At least one of those copies needs to be at a remote location.

In the old days, we usually wanted the second medium to be tape. These days, most people are happy enough making sure the second medium is just a different device. It is important to make sure that second device is out of band.

What do I mean by out of band? If your backup is to an always connected USB hard drive or a file share on your NAS, then your accidental rm -rf might delete your backup, or that piece of ransomware might take your backup right along with it! If you can see a get to a file with your file manager, it is quite likely not safe from accidents, viruses, or ransomware.

I have four copies of most of my data: on my desktop, laptop, NAS, and the Raspberry Pi. The copy on the Seafile server can only be accessed via the Seafile client using its own protocol. I wouldn’t be surprised if a dedicated attacker could exploit this connection somehow, but a random piece of malware or an accidental rm -rf certainly isn’t going to have a way to delete anything in the server’s history.

The Seafile server is six miles away.

Am I really $10 ahead? Will I really save another $300 by 2023?

This first year involved a bit of financial risk. I don’t know what sort of warranty I have on my Pi or 14 TB Seagate hard drive, but the odds of that hard drive dying are a good bit higher than zero. Having to pay for a new replacement hard drive would have set me back quite a bit on this journey.

Please don’t forget that time is money. I invested some numbers of hours of my time in February in the hopes that I will be able to save $200 or $300 each year for the next two or three years.

How much time did it take to get my Pi server up and running? I didn’t keep track, and it took me a lot longer because I was documenting the process in various ways as I was going.

If we ignore the blogging aspect of things, I will be surprised if I spend anywhere near 8 hours between installing and maintaining my Seafile Pi during the first two or three years.

It is probably important to note here that I’m comparing pricing to other services based on the storage I am actually using. I don’t have 6 TB of cloud storage. I have 14 TB. That would be more like $700 per year from Google Drive.

Should you be hosting your own cloud storage?

Most people shouldn’t. Most people fit in the free or nearly free tiers of Dropbox or Google Drive. The savings really start to become clear as your storage needs approach or exceed 2 TB.

Self-hosted cloud file synchronization isn’t exactly a drop-in replacement for a service provider. There are some advantages that I appreciate very much, but there are also a number of important disadvantages.

Dropbox is making sure your data is replicated to multiple locations. Google is making sure there are backups and redundancy. Even if that weren’t the case, they are doing work that would take you at least a few hours.

Maybe I have to do a little work, but I also know my files aren’t leaving the computers that I own. I don’t have to worry about Google restricting my files.

Dropbox’s unlimited business plan is potentially a really good value at $750 per year, but I can buy a lot of storage for my Raspberry Pi server with that $750. That could be something approaching 60 TB, and as long as those drives don’t fail, that would be $750 back in my pocket next year.

The important thing to note here is that I am quite willing to suffer through a cloud storage outage. If Brian’s 3D printer catches on fire and takes out my Raspberry Pi, I can order a new Pi and hard drive from Amazon and have it here in two days. I have a copy of the MicroSD card that I can pop into a fresh Pi in a few seconds, and I’ll be resyncing my Seafile libraries in no time.

I wouldn’t have done this without Tailscale and the buddy system

The worst part about hosting my first Seafile server was that it was exposed to the Internet. I had to watch for Debian or Seafile security alerts like a hawk. I had to drop whatever I was doing and get to work patching things when updates were available. That was a lot of work!

I’m hosting Seafile on my Tailscale mesh VPN network. My Raspberry Pi’s firewall is blocking just about everything on the Ethernet port except Tailscale, so there are only four or five computers that are even able to connect to my server.

There’s only one downside to this for me, but it isn’t a big one. I can’t use Seafile’s built-in file sharing abilities. Tailscale lets you share individual machines with other Tailscale users, and I have shared my Seafile server to both my wife and my co-host on The Create/Invent Podcast.

My Raspberry Pi is colocated at Brian Moses’s house. It is sitting underneath his Prusa MK3 3D printer, and it is connected to his gigabit Internet connection. This is essentially free for me, though I of course offered to plug a similar device into my network whenever he gets around to it.

I’m looking forward to the next year or two!

If you had asked me to implement this same setup half a decade ago, I would have been hesitant. I used to have a stack of USB 2.0 drives in a RAID 5 that I would plug into my Core Duo laptop for backups and extra storage, and those drives were more than a little flaky.

In that same era, hard drives were getting pretty awful. Every time I’d buy a stack of hard drives to build a RAID, I usually had a failed disk within the first couple weeks, and it was normal for a disk to fail about once a year after that.

Things have changed. Two of the 4 TB drives in my virtual machine server are six years old, and the other two aren’t all that much fresher, and they’re all still happy. Until we flipped the breaker to shut down Brian’s office last week to install a fancy old Wink Relay smart switch, my Raspberry Pi server had an uptime over 180 days with no weird USB errors or hiccups.

My investment has paid for itself, and I absolutely won’t be surprised if the hard drive lasts long enough to pay for itself three or four times over.

NOTE: It is important to take measures to not wear out your Pi’s microSD card. You can use raspi-config to use an overlay filesystem, which is a fantastic idea. I just made sure to disable as much logging as I can, since that’s what 99% of the writes end up being.

The math looks better if you buy a smaller hard drive!

My 14 TB drive isn’t quite the largest USB hard drive available, but it is far from the smallest. I didn’t need to go this large. An 8 TB drive would have cost less, and it would probably take me three years to fill it up, but the 14 TB drives are usually the lowest costs per terabyte. It is also better to have extra space than too little space!

The 6 TB version of my Seagate USB drive was on sale for $104 during the first week of December. That and the Pi would have cost me around $160. That’s 50% more storage for $35 less than the annual price of 4 TB of storage from Google.

Not only that, but sometimes the best computer is the one you already have. There’s an old Intel Core i3 laptop with 8 GB of ram in my closet. I could have used that instead of the Pi, and I would have saved about $55. Not only that, but every laptop comes with a built-in UPS!

You don’t have to do exactly what I’ve done. There are so many ways to accomplish the same thing! You can use a smaller drive. You can use an older, weaker Pi. You can run Syncthing or Nextcloud, or you could even use ZFS push to send backups to the Pi.

NOTE: All of this is a little weird during the current supply chain conundrum. It is difficult to buy a Raspberry Pi 4 for the price I got less than a year ago, and I have no idea when that will get better. I am particularly excited about the idea that you could build a 14 TB micro server for about 20% more than the cost of the disk. It is still neat today that you can do it for less than 33% more than the cost of the disk, but the more that gap increases, the less cool it is!

Conclusion

I couldn’t be more pleased with my off-site Raspberry Pi cloud storage server. I have convenience. I have piece of mind. I have security. I am maintaining my privacy. I’m saving money. What more could I ask for?

I only have one disappointment. I bought Pi with 2 GB of RAM for my Seafile project, but I swapped it with the 4 GB Pi from my Pi-KVM build. Neither requires more than a few hundred megabytes of RAM, and I figured I’d eventually find something else to host off-site on my Tailscale accessible Raspberry Pi server.

My Seafile Pi is using less than 300 megabytes of RAM right now, and I haven’t come up with anything to host out there. Maybe you can give me some suggestions?!

What do you think? Am I crazy for not just paying Dropbox for my sync and remote storage needs? Do you expect I’ll be doubling my investment in savings by this time next year? Are you already doing something similar, or do you have plans to build something similar? Let me know in the comments, or stop by the Butter, What?! Discord server to chat with me about it!

Comments