Skip to main content

falkp.no/blog

Tag: Zfs

ZFS on laptop with encrypted /home

With Ubuntu 19.10 it’s simple to get a workstation with boot and root on ZFS. But what’s missing from the install is encryption. This is how I did it.

I suggest you first have:

  • basic zfs knowledge
  • good linux knowledge
  • no important data on the target system
  • more than 4 GB RAM
  • SSD or better

# How-to

  • Install Ubuntu as normal, but choose “use ZFS”. It’s marked as experimental, but that’s because how Ubuntu uses it may change in later releases. The code it self is solid.
  • After install is done, you’re left with a bpool and an rpool. I will only focus on encrypting /home/. I’ll use username john in this example.
  • Your layout will look something like this:
$ zfs list -r rpool
NAME                                               USED  AVAIL     REFER  MOUNTPOINT
rpool                                              165G   293G       96K  /
rpool/ROOT                                        18,8G   293G       96K  none
rpool/ROOT/ubuntu_oyzpo3                          18,8G   293G     3,92G  /
rpool/ROOT/ubuntu_oyzpo3/usr                      1,06M   293G       96K  /usr
rpool/ROOT/ubuntu_oyzpo3/usr/local                 992K   293G      144K  /usr/local
rpool/ROOT/ubuntu_oyzpo3/var                      13,4G   293G       96K  /var
rpool/ROOT/ubuntu_oyzpo3/var/games                 320K   293G       96K  /var/games
rpool/ROOT/ubuntu_oyzpo3/var/lib                  4,36G   293G     3,72G  /var/lib
rpool/ROOT/ubuntu_oyzpo3/var/lib/AccountServices   320K   293G       96K  /var/lib/AccountServices
rpool/ROOT/ubuntu_oyzpo3/var/lib/NetworkManager   3,67M   293G      208K  /var/lib/NetworkManager
rpool/ROOT/ubuntu_oyzpo3/var/lib/apt              87,0M   293G     74,9M  /var/lib/apt
rpool/ROOT/ubuntu_oyzpo3/var/lib/dpkg             87,4M   293G     41,2M  /var/lib/dpkg
rpool/ROOT/ubuntu_oyzpo3/var/log                   574M   293G      170M  /var/log
rpool/ROOT/ubuntu_oyzpo3/var/mail                 2,25M   293G      104K  /var/mail
rpool/ROOT/ubuntu_oyzpo3/var/snap                 8,46G   293G     8,46G  /var/snap
rpool/ROOT/ubuntu_oyzpo3/var/spool                10,4M   293G     3,51M  /var/spool
rpool/ROOT/ubuntu_oyzpo3/var/www                   320K   293G       96K  /var/www
rpool/USERDATA                                     141G   293G       96K  /
rpool/USERDATA/john_75qybu                         140G   293G      126G  /home/john
rpool/USERDATA/root_75qybu                        1,07G   293G     1,07G  /root

We want to replace rpool/USERDATA/john_75qybu with a new, encrypted file system.