Best practice for encrypted BTRFS: LUKS or something else?
Hi!
I am plannung to deploy a new (used) laptop.
This time I like to encrypt it all, not just part of it.
Before I already used ecryptfs to encrypt part of the data residing on BTRFS, however I have the impression that ecryptfs is in kind of a maintenance mode. And to what I read Ubuntu stepped away from it. Before that I used encfs but that is out of the question as well.
So what is left? BTRFS on LUKS/dm-crypt?
I plan about 2 TB of SSD storage without RAID initially and I think I would, again, like to use BTRFS on top of LVM – it needed a slight change to Debian initramfs-tools built RAM disk in order to boot a BTRFS RAID 1 from LVM, but I know what to do there. However I intend to put a second SSD in there and use BTRFS RAID 1 for most critical data. I am going to boot from Coreboot.
What is the best practice for such a kind of setup these days? I am not completely up to date with BTRFS on LUKS, but as far as I understand meanwhile it is a setup that can work nicely. Is it?
Are crc32c checksums sufficient or should I select one of the new ones? How about free space cache? I am using v2 already and unless I learn something else would use v2 again.
Anything else to consider?
I'd love to see native encryption for BTRFS, but AFAIK patches related to that are still kind of stalled. Any updates on that?
Best,
Signature · 1 line
Martin
Quoted 5 lines · Martin Steigerwald
Hi!
I am plannung to deploy a new (used) laptop.
This time I like to encrypt it all, not just part of it.
On my personal laptop I encrypt primarily in case the laptop is lost or stolen. A secondary consideration is that when the disk dies, I can just send it to recycling without having to physically destroy it.
I use BTRFS over LVM over LUKS/dm-crypt. It works well, although it is a bit slow on this laptop (which has an old and slow processor, very little memory, and encrypted swap). However, I do find that suspend/resume is not reliable - I am not sure how much of that is due to the complex setup. But BTRFS copes when the system is booted after a resume failure!
A bit more detail...
I have one disk (a rotating disk). I have 2 partitions: an unencrypted ext2 partition for /boot, and then all the rest of the disk in one data partition. The data partition is encrypted with LUKS (prompts for password during boot) and is one LVM PV and VG. That VG has two LVs: one for swap and one for the btrfs filesystem.
When I next rebuild it, I will probably make the setup closer to what I run on my home workstation and home server: 4 partitions (bios_boot, unencrypted /boot, swap partition, data partition). On those systems the swap partition is encrypted (although not included in LVM) - I probably won't bother with encrypted swap on the laptop next time, to make it faster.
Anyway, my experience with BTRFS over LVM over LUKS is that it works well on all these systems. On the server, some of those BTRFS filesystems use BTRFS RAID1 (using LVs which are on different disks, of course).
But test that suspend/resume works reliably for you (including when suspend is triggered by the battery running down).
Graham
P.S. Let me know off-list if you would like me to send you my personal "cheat sheet" reminding me of the steps needed to set up this configuration.