19.10: Enable encryption in ZFS

When you choose the experimental ZFS on Linux option in the Ubuntu installation of 19.10 (and also 20.04), you end up with something like this:

NAME USED AVAIL REFER MOUNTPOINT
bpool 91,8M 1,66G 96K /boot
bpool/BOOT 91,1M 1,66G 96K none
bpool/BOOT/ubuntu_uxtu99 91,0M 1,66G 91,0M /boot
rpool 4,93G 886G 96K /
rpool/ROOT 4,22G 886G 96K none
rpool/ROOT/ubuntu_uxtu99 4,22G 886G 3,60G /
rpool/ROOT/ubuntu_uxtu99/srv 96K 886G 96K /srv
rpool/ROOT/ubuntu_uxtu99/usr 224K 886G 96K /usr
rpool/ROOT/ubuntu_uxtu99/usr/local 128K 886G 128K /usr/local
rpool/ROOT/ubuntu_uxtu99/var 487M 886G 96K /var
rpool/ROOT/ubuntu_uxtu99/var/games 96K 886G 96K /var/games
rpool/ROOT/ubuntu_uxtu99/var/lib 479M 886G 373M /var/lib
rpool/ROOT/ubuntu_uxtu99/var/lib/AccountServices 96K 886G 96K /var/lib/AccountServices
rpool/ROOT/ubuntu_uxtu99/var/lib/NetworkManager 160K 886G 160K /var/lib/NetworkManager
rpool/ROOT/ubuntu_uxtu99/var/lib/apt 62,6M 886G 62,6M /var/lib/apt
rpool/ROOT/ubuntu_uxtu99/var/lib/dpkg 43,5M 886G 43,5M /var/lib/dpkg
rpool/ROOT/ubuntu_uxtu99/var/log 7,06M 886G 7,06M /var/log
rpool/ROOT/ubuntu_uxtu99/var/mail 96K 886G 96K /var/mail
rpool/ROOT/ubuntu_uxtu99/var/snap 96K 886G 96K /var/snap
rpool/ROOT/ubuntu_uxtu99/var/spool 124K 886G 124K /var/spool
rpool/ROOT/ubuntu_uxtu99/var/www 96K 886G 96K /var/www
rpool/USERDATA 715M 886G 96K /
rpool/USERDATA/blah_mk6ljb 714M 886G 711M /home/blah
rpool/USERDATA/root_mk6ljb 640K 886G 640K /root`

I was able to enable dedup and compression but not encryption.
zfs get compression shows lz4 and on for dedup (except on boot pool). The command sudo zpool set feature@encryption=enabled rpool doesn't cause any errors but zfs get encryption afterwards still shows encryption off.

How do I enabled encryption and choose a cipher etc..?

Why all of these pools? www, snap, mail, games... Can I get rid of them?

This is on a 1TB SSD, in case that is relevant.

1 Answer

Question: How do I enabled encryption and choose a cipher etc..?

ZFS encryption can only be enabled at the time of pool or filesystem creation. The cipher is set as an option. Easiest way is performing the following steps when installing Ubuntu.

  • Boot from install ISO.
  • Click the Try Ubuntu option.
  • Open the terminal application.
  • Sudo to root. No password required.
  • Edit /usr/share/ubiquity/zsys-setup.
  • Search for zpool create command applicable to the rpool.
  • Preprend echo MYPASSWORD | to the zpool command.
  • Add the following lines before the last zpool create option line.
-O encryption=aes-256-gcm \
-O keylocation=prompt \
-O keyformat=passphrase \

Please ensure to use double quotes around the password escaping bash characters "\$ if used in the password.

The result should look like the following

echo <password> | zpool create -f \ ... -O encryption=aes-256-gcm \ -O keylocation=prompt \ -O keyformat=passphrase \ -O mountpoint=/ -R "${target}" rpool "${partrpool}"
  • Run ubiquity to start the installer

Question2: Why all of these pools? www, snap, mail, games... Can I get rid of them?

Those www, snap, mail entries are ZFS file systems mounted at the mentioned mount points, not ZFS pools. These filesystems are where files are stored and there is no issue in having lots of ZFS file systems. In fact that is one of the advantages of ZFS in offering great flexibility with file system layouts, snapshots, naming and performance tuning.

You can delete them, but that means it will delete all files located within that file system.

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

You Might Also Like