Sunday, July 03, 2022

DS620slim tiny home server

In this blogpost, I describe the Synology DS620slim. Mostly these are notes for myself, so when I need to replace something in the future, I can remember how I built the system. It's a "NAS" (network attached storage) server that has six hot-swappable bays for 2.5 inch laptop drives.

That's right, laptop 2.5 inch drives. It makes this a tiny server that you can hold in your hand.

The purpose of a NAS is reliable storage. All disk drives eventually fail. If you stick a USB external drive on your desktop for backups, it'll eventually crash, losing any data on it. A failure is unlikely tomorrow, but a spinning disk will almost certainly fail some time in the next 10 years. If you want to keep things, like photos, for the rest of your life, you need to do something different.

The solution is RAID, an array of redundant disks such that when one fails (or even two), you don't lose any data. You simply buy a new disk to replace the failed one and keep going. With occasional replacements (as failures happen) it can last decades. My older NAS is 10 years old and I've replaced all the disks, one slot replaced twice.

This can be expensive. A NAS requires a separate box in addition to lots of drives. In my case, I'm spending $1500 for a 18-terabytes of disk space that would cost only $400 as an external USB drive. But amortized for the expected 10+ year lifespan, I'm paying $15/month for this home system.

This unit is not just disk drives but also a server. Spending $500 just for a box to hold the drives is a bit expensive, but the advantage is that it's also a server that's powered on all the time. I can setup tasks to run on regular basis that would break if I tried to regularly run them on a laptop or desktop computer.

There are lots of do-it-yourself solutions (like the Radaxa Taco carrier board for a Raspberry Pi 4 CM running Linux), but I'm choosing this solution because I want something that just works without any hassle, that's configured for exactly what I need. For example, eventually a disk will fail and I'll have to replace it, and I know now that this is something that will be effortless when it happens in the future, without having to relearn some arcane Linux commands that I've forgotten years ago.

Despite this, I'm a geek who obsesses about things, so I'm still going to do possibly unnecessary things, like upgrading hardware: memory, network, and fan for an optimized system. Here are all the components of my system:
You can save a bunch of money by going down to 4TB drives (and a 14TB backup USB drive), but I chose the larger 5TB drives.

Disk Drives

The most important reason for choosing this product is the smaller 2.5-inch disk drives (sized for laptops). Otherwise, you should buy one of the larger (much larger) system that'll holder standard sized drives.

The drives will be largest cost. A 5TB spinning disk costs ~$150, or an 8TB SSD flash costs ~$700. Buying 6 of them is your largest investment. You don't have to fill up the system, or buy the largest drives, but if you put in the time and effort, you might as well go all the way. On a cost-per-gigabyte, the larger drives seem to be best price.

As you know, there are only three manufacturers remaining for spinning rust drives: Seagate, Western Digital (WD), and Toshiba. Also as you know, laptops have moved away from rotating disks, adopting SSDs instead. Thus, the 2.5 inch form factor for spinning disks is likely dead. For right now, they are a lot cheaper than SSDs, a fifth of the price. In the future, when a drive dies on the array, I'll likely have to replace it with an SSD, because a replacement spinning disk is no longer available. The SATA SSD itself is eventually going to disappear (to be replaced by NVMe SSDs), but they should still be around a decade from now when I need replacement drives. (I plan on the NAS lasting a decade before I have to upgrade and move the data).

The internal 5TB drives are a bit expensive. One strategy would be to instead buy external USB drives and "shuck" them, removing the USB enclosure to get at the drives themselves. It's a common strategy when under certain market conditions, external drives are cheaper than internal drives. I tried buying a $100 5TB Western Digital external drive. It didn't work -- it wasn't a SATA drive in a USB enclosure, but was natively USB on the circuit board. I'm using it as a Raspberry Pi 4 drive instead for storing blockchain info.

Inserting the drive into the 620slim is easy: just pop out the carrier, add the drive, and pop it back in. The carrier comes with little posts on one side that fit the screw holes, meaning you only need to screw in the other side with 2 screws -- or you can forgo the screws altogether.

The carriers have locks, to prevent people from accidentally pulling out a drive, but I don't use them. In 5 years when a drive fails and I need to replace it, I don't want to go hunting for these keys. The entire strategy I'm using here is that when failure happens, I'll fix it right away rather than finding reasons to procrastinate. I've had to replace 3 failed drives in my previous NAS, and this worked well.

Memory

The DS620slim comes with 2-gigabytes of memory, in a single SO-DIMM slot. There's a second empty SO-DIMM slot. (SO-DIMMs are the smaller form factor for memory that's intended for notebook computers and tiny servers).

Synology will officially sell you a 4-gig SO-DIMM to put in the empty slot, bringing total memory to 6-gigs.

Unofficially, you can get two of these, using the second to replace the existing 2-gigs, brining it to 8-gigs total.

Even more unofficially, you can go to 16gigs. According to Intel's official spec sheet for the J3355 CPU, it only supports 8-gigs. Such numbers are usually conservative, reflecting the memory available at the time. When larger capacities appear later, they usually work. Such is the case here, where I put in 16-gigs total using Crucial SO-DIMMs (two 8-gig DIMMs).

I recommend expanding memory here, if only an extra 2gig DIMM to fill that free space. It's a quick and easy replacement, just unscrew the bottom plate and insert the memory.

Ethernet

The unit only comes with gigabit Ethernet. This can be a bottleneck, so we want to speed that up.

It comes with two Ethernet ports, which support aggregation, but I couldn't get a speed increase. It seems they'll speed things up if there are at least two devices talking to the NAS, but won't speed up when there's only one client. But then, if you have two clients, then things will slow down anyway, because accesses are no longer sequential.

The solution is to use a faster Ethernet adapter, like 2.5gig, 5gig, or 10gig. There's no PCIe slot in the device, but it does have USB 3. I can therefore use a 2.5gbps or 5gbps dongle.

I benchmarked the three options, and found the following performance, in mbps (mega-bits per second). This was measured with large sequential transfers, small or random transfers are roughly the same speed, around 350mbps, for all three adapters.


There's a big jump in performance using the 2.5gbps adapter, but only a marginal increase using the 5gbps adapter.

Synology doesn't support the adapters directly. To install them, I used the following steps with the following project:
  1. Enable SSH, using (Control Panel -> Terminal). If you are a geek, you've already done this.
  2. Go to this GitHub project and download the the r8152-apollolake-2.15.0-5.spk file (from the Releases section) to your local computer. Your DS620slim has an Apollo Lake CPU, so that's the package we are using.
  3. Use the "Package Center" to do a "Manual" install, and upload this SPK file. If you get an error saying you don't have permissions, log out and back in. Otherwise, you'll first get a warning saying the driver isn't supported by Synology, and eventually you'll get the error "Failed to install package". This is supposed to happen.
  4. From the SSH command-line, run the command:
  5. sudo install -m 4755 -o root -D /var/packages/r8152/target/r8152/spk_su /opt/sbin/spk_su
  6. Now repeat the step using "Packet Center" to do a "Manual" install. If you didn't close the window that you had open, you can just click on the "Done" button a second time and it'll work.
  7. Now reboot, and plug in the USB adapter.
For 5-gbps, you can use go through the same process to install Aquantia aqc111 drivers. I did this to get a Sabrent NT-SS5G adapter to work.

In practice, when transferring large files, you still aren't going to be able to exceed 2.5gbps much, so I just use the slower adapter. It's cheaper and uses a lot less electrical power (a 2.5gbps Ethernet adapter is noticeably cooler than a 5gbps, which is in turn noticeably cooler than 10gbps).

Fan

The unit comes with a small fan that by default will run in "quiet" mode, but under load, the noise becomes noticeable. A cheap $15 gets a fan that runs a lot quieter, like a Noctua fan famous for this. Replacing the fan doesn't require any tools, as it's held in by rubber thingies.

This allows me to run the fan at a higher speed, with less noise, which keeps everything even cooler. Since I plan on a 10 year lifespan with rotating disks, I figure lower temperatures will be better for longevity.

USB drive backups

RAID6 gives pretty good safety, allowing two drives to fail with no data loss. The term "RAID5" means one redundant disk, the term "RAID6" means two redundant disks.

But you should still do backups. The NAS itself can fail. Or, ransomware can delete all the files. There's lots of possible failures.

One of the neat things with Synology is that it's easy to schedule regular backups to an external USB drive.

In my case, I'm using an 18 terabyte USB drive costing $400 for backups. I just schedule it and forget it, backups always happen, and ransomware on Windows machines can delete everything on the NAS but can't touch the backup.

UPS (Uninterruptable Power Supply)

For a small NAS, I bought a small UPS. This is some weird APC unit that I got on close-out for $100. It's such a weird little product that I don't think it was very popular.

It's a lithium ion UPS. The price for lithium batters, especially LiFePO4, is approaching the point where they are price competitive with traditional lead acid batteries. This is especially true considering that they last longer in UPS applications than lead acid.

File system

Now with hardware out of the way, let's talk software. Once you insert the drives, plug in the Ethernet, and turn on the power, you access the device with a web browser and configure from there.

There are several choices for how you want to configure RAID and the filesystem.

I chose BTRFS on top of RAID6.

BTRFS is a new Linux filesystem that's increasingly becoming the default. It's major feature is that it includes checksums for files as part of their metadata (along with filenames and timestamps). This allows the filesystem to detect when a file has become corrupted, so that the file can be repaired. Bits will rot on hard disk, so files can become corrupted over time even if the files are never written to or read. Scrubbing prevents this from happening. With Synology, I simply configure it to scrub the entire filesystem every month.

This is not "btrfs-raid", but "btrfs-on-raid6". BTRFS has some experimental RAID built-in, but it's buggy and doesn't really work. Instead, I first create a RAID6 array combining multiple drives into a single virtual drive, then put BTRFS on top of that.

These boxes are designed to allow multiple filesystems to be created, but I create simply the one. I do have multiple "shares", though, such as for videos and music, but these are still just directories on the same filesystem.

I also occasionally take "snapshots". I'm not sure how that works since I've never restored a snapshot, but in principle it'll be quicker restoring from backups.

Summary

If you are looking for between 16TB and 20TB, for more personal use than a large office, it's rather perfect. Yea, it'll be 4 times more expensive than just getting an external USB drive, but it's RAID and it's own server.

It's so cute I got a second one and filled it with 2TB SSDs, for database accesses that spend a lot of time searching through large database of poorly indexed data (like password dumps).

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.