As I've a fully encrypted Ubuntu 20.04 with zfs running, I wanted to test if the same would be possible for proxmox, because I want to migrate the ubuntu installation over to proxmox.
Im not the biggest fan of the luks + zfs version, because of the added complexity, while it should be possible only with zfs. So I searched a while and found some bits and pieces her in the forums and the zfs repo.
Right now I have the root of my proxmox server encrypted and the password is asked at boot via console and ssh. So I can input the password locally or remotely.
Because I found no complete tutorial, I created a forum account to share with you what I've done so far.
Warning: You will need zfs 0.8.5 or newer, as far as I know. ,So this will only work proxmox 6.3 or newer. I've tested it with the newly released 6.4 version.
- Install proxmox and choose zfs raid 0 in the installer.
- After installation I booted right into the rescue mode and followed this link to a gist with instructions(which is originally from this forum. Thanks @Yakuraku)
- In addition to the tutorial, I had to move the mount point of the dataset "copyroot/pve-1" to /rpool/copyroot/pve-1 to get work. Because without this, there where two datasets with the same mount point and the system didn't boot.
- Another way would be to delete delete the old copyroot stuff after migrating. That's what you would like to do anyways.
- After that I was able to boot into the system.
- Because I want to unlock my encrypted root dataset remotely, there was one other step to do. Since zfs 0.8.5 it's possible to unlock zfs datasets via ssh while the system is booting. It's fairly simple, but a bit harder to find. Just follow the instructions at the bottom of the initramfs readme from zfs github repo
- After that there was only one more step to do: encrypting the dataset for vms and containers. That's well documented in the proxmox documentation
- Create an encryption key:
Code:
openssl rand -hex -out /root/data-encrypted.key 32
- Create new encrypted dataset:
Code:
zfs create -o encryption=on -o keyformat=hex -o keylocation=file:///root/data-encrypted.key rpool/data/encrypted
- Add the encrypted dataset to proxmox:
Code:
pvesm add zfspool encrypted_zfs -pool rpool/data/encrypted
I hope that little writeup helps anyone.