Recently I have started thinking about backups on my personal web server (on which this blog is hosted on). Simplest solution I have come up with is to just mount additional drive to the server, format it as ZFS, sync stuff to it and then just snapshot that drive. This way I don’t use much space for storing backups and I can keep more frequent backups.

Sure, I could just move website to that ZFS drive, and I will probably do so in future, but for now it is how it is.

Everything sounds simple, right? Right! So I’ll just explain how to set up ZFS on CentOS 7.

First thing you’ll need to do is to install ZFS, I’ve opted in for installing DKMS version of ZFS on Linux, that way I don’t have to keep track of if kABI version is tracking kernel version or do I need to wait for an update.

To enable ZFS repository ZoL wiki suggests:

$ sudo yum install https://download.zfsonlinux.org/epel/zfs-release$(rpm -E %dist).noarch.rpm
$ gpg --quiet --with-fingerprint /etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux
pub  2048R/F14AB620 2013-03-21 ZFS on Linux <zfs @zfsonlinux.org>
    Key fingerprint = C93A FFFD 9F3F 7B03 C310  CEB6 A9D5 A1C0 F14A B620
    sub  2048R/99685629 2013-03-21</zfs>

After that install ZFS with:

sudo yum install kernel-devel zfs

It is recommended to reset SystemD presets so pools and mounts will be imported and mounted at boot normally:

systemctl preset zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target

Aaaand, that’s basically it regarding installation side. Now you can continue with creating your zpool:

zpool create myzpool /dev/sdb

and check your pool status with:

zpool status -v

There are of course many different configurations regarding zpool redundancy and many, many tuneables for ZFS. Personally I prefer FreeBSD handbook ZFS chapter for all things ZFS so I’ll just point you there for more info.

Even with “additional complications” and the fact ZFS isn’t supported out-of-the-box on Linux it is still pretty easy to set up and even easier to administer in comparison to some other filesystems.