I am currently trying to change over a data dump server running 19.04 from LUKS+btrfs to ZFS. The system drive is LUKS-encrypted and can be decrypted via SSH. It contains a key file that is supposed to decrypt the ZFS filesystems. I am halfway there but automount does not work.

  • I have managed to compile ZFS 0.8.1 and build a DKMS package following the wiki. By reading the makefile, I have in addition found out that I also need to make deb-utils to get zpool and such.
  • I created a pool that supports encryption

    zpool create -o ashift=12 dataint /dev/disk/by-id/mydrive zpool set feature@encryption=enabled dataint

  • I created filesystems in it that are encrypted with the keyfile

    zfs create \ -o encryption=on \ -o keylocation=file:///root/keys/hdd256.key -o keyformat=raw\ dataint/test

  • I can mount this with zfs mount dataint -l

The issues I have now are:

  1. zfs is not loaded at startup. Not even the kernel module and accordingly certainly not the pool.

  2. Encrypted volumes are only loaded when the pool is imported or the filesystem is mounted with the -l option. I guess that has to be addressed somehow for autoload when 1. is solved?

I do have some zfs systemd services, but they are masked. Not sure if they are leftovers from a prior 0.7 package manager installation, which I removed.

2

2 Answers

Try to manually enable all the installed parts.

To see what zfs-related services your system has installed:

sudo systemctl list-unit-files | grep zfs 

Next, enable all the services. I'm being verbose:

sudo modprobe zfs sudo systemctl enable zfs-import-cache sudo systemctl enable zfs-import-scan sudo systemctl enable zfs-import.target sudo systemctl enable zfs-mount sudo systemctl enable zfs-share sudo systemctl enable zfs-zed sudo systemctl enable zfs.target 

If complaints about things being masked show up on your terminal, force remove all masks:

sudo systemctl unmask zfs-* 

You probably don't need this, but for completeness, some older systems have fewer services and prefer update-rc.d:

update-rc.d zfs-import enable update-rc.d zfs-mount enable update-rc.d zfs-zed enable update-rc.d zfs-share enable 
2

I have fully solved the issue now, which essentially has too parts.

  1. The systemd services have to be built into the deb package at all. Unfortunately, the wiki packe linked above is very sloppy, as discussed here in the issue tracker.

In short, the build commands for DKMS deb should be

$ ./configure $ make -j1 deb-utils deb-dkms 
  1. Old installation needs to be cleaned up

Command:

sudo systemctl unmask zfs* 

and the new services need to be enabled and started.

I have also described how to deal with encrypted datasets here.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy