Spinning your disk strategies
Let’s examine the manifold ways in which we can store our data more securely and less precariously.
why build your own nas? “Off-the-shelf NAS units are often expensive or limited in how much you can meddle with them.”
Have you ever run out of space on Linux? It can be quite annoying. At best you have to move some stuff, or (shudder) do some disk-based
(tidy your room!–ed) housekeeping. If your root filesystem runs out of space terrible things can happen, especially if it’s on a server you’re not logged into. You can’t log in because the system wants to write a login record, but there’s no space to do that.
Even on a desktop you are logged into, strange and unpredictable behaviour might be observed. You might be unable to logout; you might, in your haste, forcibly reboot and find that you have to boot another distro to remedy the situation, as now you’ve corrupted your filesystem and there’s no space to repair it. This is one of the reasons that having a separate /home partition is recommended. It’s not strictly essential, and contrary to popular belief it’s easy to set this up after your install.
Some users prefer to store large files on a totally different device to the root file system. This is pretty much essential if you’re sharing data with other users
on your network, and you may even want this storage to live inside another machine. With a theoretical max of about 120MB/S, gigabit Ethernet can almost keep up with yesterday’s hard drives, and consumer-level NAS devices are proving highly popular. These are great, they come in handy small form factors and many of them run Linux. They can be set up in any number of RAID (Redundant Array of Independent Disks) configurations, whether they involve mirroring, conjoining, or using parity voodoo to ensure your data stays safe even if one or more drives fail. But off-theshelf NAS units are also often expensive or limited in how much you can meddle with them or how much extra storage can be added.
It’s perfectly feasible to build your own NAS box, or indeed house a RAID array inside your desktop machine. Traditionally you’d use mdadm (multiple device administration) to handle the RAID stuff, and on top of that, you could use Logical Volume Manager (LVM) to abstract logical volumes away from physical partitions. Logical volumes can be resized on the fly, and may span any of the RAID devices, physical partitions and indeed drives beneath them. Nowadays LVM can handle the RAID stuff for you, though it still talks to the MD kernel layer as mdadm would. If you want to be hypermodern about it, you can forget about partitions altogether. Btrfs and ZFS can happily create filesystems on drives bereft of partition tables. They have their own native equivalents (volumes) as well as their own built-in RAID.
Lastly, and we say this every time, RAID is not backup. When it works, it protects against drive failure. It doesn’t protect against fat-fingered deletions, and apart from the healing features of Btrfs and ZFS it doesn’t protect against bitrot. So back up your files. Back them up to a RAID device, to the cloud, to a hard drive in a safe buried in the garden.