Backing up 2: The NAS

    Backing up 2: The NAS

    As I mentioned in my previous post, it's good to have various kinds of backups. Today I'm going to talk about on-site backups, in a Network Attached Storage.

    Network Attached Storages (NAS) are small form computers which usually have at least two hard drives. The hard drives are often hot swappable and can be taken out without dis­as­sem­bling the computer. They are meant to be always on, so they don't consume a lot of power.

    You can build your own NAS. It's not harder than building your own computer, but if you want it to look really nice and to consume few watts, you'll have to search around quite a lot for parts. The biggest hassle however is setting it up. Whether you go the Linux or Windows route, it still means con­fig­ur­ing a server. Some people find it fun, some people don't.

    I ended up buying a pre-made Synology DS916+ unit. It's a 4 drive bay, with a quad core CPU, that consumes around 30W. It's possibly an overkill even for me, but meh, I wanted to go fancy and future-proof. I put in 3 3TB WD Red drives (so I have an empty slot).

    What convinced me to go the pre-made route? The sur­round­ing ecosystem. Yes, I can configure my home network (with a sig­nif­i­cant amount of effort) and set-up all the backups, but there's no way I'm going to develop about 10 iOS/Android apps that Synology has. These apps enable me to browse my files from my phone, remotely, to stream my music, to have a remote photo library (including automatic backups of my photos taken with the phone), note taking app that sync back and so on. It basically offers you your very own little cloud. This I found super convenient.

    Setting it up is super easy. You just put in the hard drives, start it up, configure a few things and you've got a working NAS.

    One of the more important choices you have to make is how to set up your hard drives. The trade-off is between how many hard drives can fail before any data is lost and how much overhead is needed (how much space is lost). Synology supports a lot of RAID formats (0, 1, 5, 6, 10) and it's own Hybrid Raid thing. RAID 1 and 5 offer a one disk redundancy (if one disk fails, you can still recover all the data from the array), while RAID 6 gives you two disk redundancy. I went with the RAID 5 for my own NAS.

    Another choice you have to make is what file system to use. Here is where Synology has an advantage over other NAS vendors: it offers Btrfs support. This is a shiny new file system which does file level check­sum­ming and scrubbing, where it looks for files that might have been corrupted and tries to recover them from redundant copies. It has many other features, but these were the most important to me, because they prevent silent bitrot. Bitrot is a process in which a random bit on the hard drive is flipped, corrupting data. This is because small parts of the hard disk platter lose their magnetic ori­en­ta­tion. This happens on average about 10^(-14) times, so if you have a 10 terabyte array, it's almost guaranteed that it will happen during it's lifetime. This is usually detected only when you try to read the data, when you suddenly realize that it doesn't make sense anymore.  Because btrfs has check­sum­ming, it can figure out when files are corrupted and because it offers scrubbing, it can find out before you go looking for it, while there is still a redundant copy of the file, so it can recover it.

    There's a "Cloud Sync" app that enables you to easily backup your various online services, so I set it up with Google Drive and soon it downloaded everything. I also plugged in my external hard drive and downloaded everything from there. The files that live on my computer were copied using rsync or scp, even though the NAS has a fairly good web UI for uploading.

    After I uploaded all my photos, it spent more than a week indexing them in the Photo library app. It has a super primitive form of facial recog­ni­tion, which is completely useless, but it recognizes the tags that Picasa or Windows Live Gallery inserted (and they had much better facial recog­ni­tion), so I could now browse by people.

    It has a Download Station, which you can use to au­to­mat­i­cal­ly download stuff, from random pages, torrents or even YouTube videos.

    It has an Audio Station, which I use because I listen to many sermons, not all of which come in a nice podcast, so it's just easier for me to put them on my NAS and listen to them from there.

    The Video Station is pretty impressive. It can do transcod­ing on the fly and you can play in your browser or on your phone. It searches for metadata for the files that you have on the internet, to show nice images and in­for­ma­tion about it. But I use Netflix for almost all my home en­ter­tain­ment needs, so I don't put this to good use.

    All these work both from the browser and from your mobile. This attracted me the most: the con­ve­nience of mobile. And because it has support for HTTPS, it's fairly safe (as safe as something you expose to the Internet from your living room can be).

    From the Control Panel you can change most of the settings, including security ones. There are several basic ones that you have to make if you expose it to the internet, such as auto banning after several un­suc­cess­ful attempts to login.

    It also offers the option to browse over HTTPS. To avoid the complaints from the browser about a self signed cer­tifi­cate, I actually went and bought a domain for "my house". Synology has support for Dynamic DNS, so updating the domain to point to my IP is automatic. Also, it supports Let's Encrypt so getting the HTTPS cer­tifi­cate was trivial, from the Control Panel.

    It also has a web server, a mail server, a chat server and a lot of other stuff which I didn't set up. It has built-in support for Docker, so it can run whatever container you have.

    I find the DS916+ to be more than enough for my needs. Since I have it, I find it much easier to work on my various projects when I am away, because I know I can always access them even remotely, on my NAS. It's very quiet, it doesn't bother me, even though I am quite sensitive to noise. Sometimes when it starts a background process I can hear it, but most of the time it's hi­ber­nat­ing.