Full disk encryption partitioning scheme on Arch
TL;DR: For those of you with multi-drive setups with some sort of encryption, what's your partitioning scheme and why?
To start, just wanna note that I’ve read all of the documentation on encryption on Arch in the wiki, and to be fair, this is likely more a partitioning question rather than an arch question.
System Info & Goal:
- Non-UEFI Laptop
- 2 drives (2Tb HDD and 512G SSD)
- I’m looking to utilize full disk encryption.
I’ve looked into LVM on LUKS and I think this might be the way to go? Most of my confusion stems from my lack of knowledge in partitioning systems.
Essentially, I’m not sure of the best (subjective, I know) partitioning scheme for my device given the above desire.
Some of my confusions include:
- whether or not my home directory should be on a separate drive as my root,
- which drive those should reside on,
- how much space to dedicate to each of these, and similar questions that are answered through a particular partitioning scheme.
My background is in Cybersecurity, and if I'm honest, I don't have a large background in partitioning systems for particular uses. So I think it’d be helpful to hear from others whom have some sort of encryption on a multi-drive setup and why you chose what you chose. Thanks in advance.
About this post
- Posted
- Archived
- Score
- 14 · 89% up
- Kind
- Text
- ID
- 17cb185
19 comments
Your best bet is to use the 512GB SSD as
/https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system#LUKS_on_a_partition; then create a specific non-standard mountpoint for your 2TB HDD (e.g./mnt/bulk) which can be unlocked after the root partition in late userspace https://wiki.archlinux.org/title/Dm-crypt/System_configuration#crypttab .You really shouldn't put
/homeon the HDD because it will slow down all your programs (such as browser caches, local configurations, etc.). You should use the/mnt/bulk/$(id -u)folder and symlink stuff as needed (e.g.~/Music -> /mnt/bulk/1000/Music,~/Pictures -> /mnt/bulk/1000/Pictures)"main" disk encrypted and running
btrfsunder the hood on all partitions, secondary disk isext4one partition, decrypted using file key stored on the "main" drive at system start. Both encrypted usingluks. I'm not sure how secure it is, but should be good enough to keep normal people away, which is precisely what I want. There's no best partitioning solution. You can throw everything on one partition and the system will still work. You can keephomeon a separate partition if you consider reinstalling system and want to keep your personal files. I'd say keep system partitions (root,home,swapor anything else you want) on SSD, and format the other drive toext4. Keep it simple and don't complicate your life unless you know what you're doing.But you can't encrypt the "entire" disk. The efi partition has to be readable. How to handle this is where all the nuances come in.
I personally prefer two partitions: /boot and / . If you're like me, the best way to do this would be:
/boot EFI partition unencrypted
LVM combining rest of free space on that device plus other device as one logical volume
That volume contains luks encrypted volume, which when mounted, is /
So basically not LVM on LUKS but LUKS on LVM
I have /boot EFI like yours, and / encrypted and btrfs formatted. So no lvm. Is lvm better?
No, you're good here. LVM will add some overhead and is unnecessary - you get snapshots with btrfs.
The reason I recommended LVM to OP is because OP has multiple hard drives. In essence, OP will create LVM partitions on each drive and assign them to the same logical volume. That logical volume is basically treated like a block device, so OP can format the entire thing like it's one big partition and not have to worry about managing where things get installed etc
I have a 1tb drive with a 512gb drive that I installed afterwards. I have /boot and /root on my 1tb. Also have an EFI partition. My 512 is just a single partition mounted at /storage. Everything is luks2 encrypted.
I put a copy of automatic rsync backups for my /root partition (I use ext4) in /storage and use syncthing to mirror them to my desktop at home. I also manually make .tar archives of /home every couple months or so and put them in there, which get synced to my desktop as well. I avoided LVM because while it does make resizing partitions easier, there is greater chance of data loss if a drive breaks. I did not bother putting /home on a separate drive because I don't distro hop and I didn't see the point.
I have the key for the 512gb on my root partition and the key for the root in my TPM. I also use secure boot with sbctl. When I turn on my laptop, TPM auto unlocks root if the hardware has not been tampered with and the kernel is properly signed. If either of those conditions are not met, I get prompted for the encryption passphrase. Once TPM unlocks my root, the root unlocks my /storage drive. Net effect is having a single password to get into the laptop without ever exposing unencrypted file system before login. Make sure to disable USB boot and to set a password on BIOS.
Separating home from root is not really needed. It is essentially a recommendation only if you are expecting to use the same home partition in different Linux installations. Separating them offers no extra security in almost any use-case. Not separating them, there will be less constraint and uncertainty about the size of either of them. And it is just simpler.
You should put root and home in the SSD, and I recommend not to store bulk data in home, but keep it somewhere else; e.g. your HDD. You can keep notes, source files, and other frequently used things of rather low size in home; in the SSD.
Additional tip: you can use
/tmpwhen you want to get faster performance for anything. It will be even faster than the SSD. You can put any files from your HDD into /tmp and work with them from there. /tmp is a temporary "disk" on RAM, and it is there by default on Arch. Of course you are limited by your RAM, so this will work only for some cases. I personally make a lot of use of this.root and home size depends on what your system will be like and what applications you will use. I personally have 3.8GB root usage and 5.9GB home usage currently, with two separated users, in a 4+ year-old system. So the space needed can be quite low, it depends on what you will do with your system. However, you can just give your entire SSD to root + home, if you do not want to keep space specifically for something else, or to keep some just in case.
My Setup
My use-case is with two compartmentalized users; keeping their activity and data independent.
At boot, I enter the root partition password. Then, each user's separate data partition is automatically decrypted and mounted when logging in with that user, with no need to enter the partition passwords.
Here is how I do it. With no need to store keys or passwords anywhere on disk. It might be useful for you otherwise too: https://www.reddit.com/r/archlinux/comments/145eo0e/comment/jnsabmp/
I found it here, as the nicest solution to what I want: https://wiki.archlinux.org/title/Dm-crypt/Mounting_at_login
Disk layout:
NVMe SSD - 120GB
HDD - 1TB
Everything is ext4, except for boot of course. All three LUKS passwords are different.
LVM turned out to be not needed really, as I never had the need to resize the partitions or anything. I would not do LVM at all if I was doing it now. There is value in keeping things simple too. So, if you think you will not need the functinality from LVM, it might be better to omit it.
Similarly, if you do not think you will like the extra functionality from zfs, btrfs or whatever, I recommend just using ext4 and LUKS; keeping things simple and standard. I see people here that decided to use btrfs just because they read things about it being awesome, but not using or even knowing any of its extra functionality, and then complaining about issues they have.
So, my overall recommendation is to keep things as simple as your use-case allows. Also, do not overthink the security. Security and privacy lead to an endless pit of never having the perfect setup. Just having encryption on your partitions and general common-sense can be more than enough to give enough security for most people's use-cases. I do not think you are a fugitive or some high-value target for hackers.
Thank you! I really appreciate your well thought out and SUPER informative answer.
You should brush up on storage, its best covered in the RHCSA curricula (for fundamentals).
In my UEFI notebook I have an EFI partition, a btrfs partition with subvolumes and swapfile, a Windows partition and other partition for sharing data between both OS. Plus Secure Boot
straigth forward ---> https://gist.github.com/chrisleekr/a23e93edc3b0795d8d95f9c70d93eedd
ZFS. It has built-in encryption support for individual datasets. Or you can encrypt the entire pool!
Since encryption is handled entirely by ZFS, my partitions look like this:
Main SSD has a small 512 MB EFI System partition and a second partition used in ZFS spanning the rest of the drive
Both HDDs have a single partition used in ZFS, they are combined into a striped vdev by ZFS, no mdadm magic needed.