Importing and mounting ZFS pools at boot time on Fedora servers

If you read my blog you know I am a huge fan of the ZFS file system. Now that the ZFS on Linux project is shipping with Ubuntu I hope it gets more use in the real world. Installing ZFS on a Fedora server is relatively easy though I haven’t found a good guide describing how to import pools and mount file systems at boot. After a bit of digging in /usr/lib/systemd/system/ it turns out this is super easy. On my Fedora 24 server I needed to enable a couple of systemd unit files to get my pool imported at boot time:

$ systemctl enable zfs-mount.service
$ systemctl enable zfs-import-cache.service
$ systemctl enable zfs-import-scan.service

Once these were enabled I rebooted my server and my pool was up and operational:

$ zpool status -v

pool: bits
state: ONLINE
scan: none requested

bits ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
ata-WDC_WD7500AACS-00D6B1_WD-WCAU47102921 ONLINE 0 0 0
ata-WDC_WD7500AACS-00D6B1_WD-WCAU47306478 ONLINE 0 0 0
ata-WDC_WD7500AACS-00D6B1_WD-WCAU47459778 ONLINE 0 0 0
ata-WDC_WD7500AACS-00D6B1_WD-WCAU47304342 ONLINE 0 0 0

errors: No known data errors

$ df -h /bits

Filesystem Size Used Avail Use% Mounted on
bits 2.0T 337G 1.7T 17% /bits

The future is looking bright for ZFS and I hope the Linux port will become rock solid as more people use it.

This article was posted by Matty on 2016-12-23 12:20:00 -0400 -0400