Adventures in FreeBSD and ZFS Land
The single 2TB (1.82TiB) HDD I had for storing mediia/downloads/backups wasn’t cutting it, so I finally decided to go through with turning my old PC into a file server and ordered 2 more of the Samsung SpinPoint F4s (HD204UI). Ever since I came across an article on ZFS, which has been touted as the last word in file systems and has a great built-in software RAID engine, I’d made up my mind that was what I was going with. But unfortunately due to licensing issues, it’s not natively supported in Linux, so I couldn’t use Debian or Ubuntu Server like I would’ve preferred. My choice for OS were OpenSolaris, OpenIndiana, FreeBSD, or a distribution based off those (EON, FreeNAS, etc). OpenIndiana is way too new for me to feel comfortable using, so that was never really an option; OpenSolaris has the most mature ZFS support, but the OS itself is effectively dead as an open source product; FreeBSD doesn’t support the most up to date versions of ZFS, but since I’m not planning on using RAID-Z2 or Z3 (yet), it’s not as big a deal – whereas the OS still being updated and supported is. FreeBSD it is.
The first thing I have to say for FreeBSD is that it really makes me appreciate how good of a job Linux distros have done in making the install and configuration process sensible and painless. Sure, Ubuntu is by far the most consumer (or one might say n00b) friendly of them all, but even the GUI-less install for Ubuntu Server can get you up and running with practically everything you need in less than an hour – just anything that’s not already installed is only a few apt-get commands away. By comparison, from when I put in the FreeBSD CD to install for the first time, to when I finally had a working minimal installation (basically FreeBSD with SSH and Samba) took… about 6 hours. This included at least 3 full reinstalls of the OS and 40+ minutes spent on updating ports list and then installing Samba each time by downloading sources for all dependencies from a bunch of FTP servers and compiling them. Installing vim, my *nix editor of choice, took even longer because I didn’t realize gvim was included in the vim port, and thus had to download a ton of GUI dependencies… some of them off Belgian FTP servers at the blazing speed of 60KB/s. So lesson learned – use the vim-lite port if, god forbid, I have to ever do it again. And I have never appreciated APT (or even YUM, which I don’t like nearly as much as) more.
After that, it was time to set up the ZFS RAIDZ pool. At least this part went pretty swimmingly by following the excellent guide by sub.mesa – his FreeBSD install/setup guide is pretty good too, though the site was down when I was doing my install. The only real issue was when I forgot to create filesystems using the zfs create command and just created directories via mkdir in the zpool. Which worked… but then caused the ~50GB of data I’d copied onto it to disappear on the next restart… oops. Also had to recompile Samba to enable AIO, but that was quite painless.
And so, after hours spread out over 2 days… I’ve got a working file server with 3.62TiB of usable space. Performance is unfortunately not quite great – I seem to be limited to about 65MB/s writing to it over my GbE network, compared to the 80+ I was getting when I just had the one HDD shared under Windows 7. It does not appear to be a disk bottleneck, as I was getting the same speeds on the set of 3 old Seagate 7200.10 160GB drives I tested with too. It’s likely a combination of my computer being underpowered (single-core A64 2.4GHz with only 2GB of RAM is rather less than usually recommended for a ZFS file server) and the normal Samba overheard, so I’ll wait until I (most likely) switch over my current Phenom II X3 system for that use, and investigate further if it’s still slow.
In the meantime, I’ll be watching the progress bar as 1.6TB of data (somewhat slowly) makes its way across my network.
