Recommended partitioning strategy (encryption and btrfs)?
I'm coming to Arch from Ubuntu where I always used to use ext4, LVM, and full-disk encryption on LUKS. It would look like this:
sda disk
├─sda1 part /boot
└─sda2 part
└─encrypted (dm-0) crypt
├─ubuntu-root (dm-1) lvm /
├─ubuntu-home (dm-2) lvm /home
├─ubuntu-swap (dm-3) lvm [SWAP]
└─ubuntu-stuff (dm-4) lvm /stuff
Since I'll be learning a lot about Arch during my transition from Ubuntu, I figure it's a good opportunity to also try btrfs instead of LVM. Also a good time to get ideas on better ways to partition things since I've been doing it the way above for years.
If I still want full-disk encryption, and want swap to continue to be encrypted as well (for security if the memory is persisted to swap during hibernation), what would you recommend?
Would you keep everything identical and just use btrfs subvolumes instead of LVM volumes (if swap can even be a btrfs subvolume), or would you do it differently?
About this post
- Posted
- Archived
- Score
- 1 · 100% up
- Kind
- Text
- ID
- 331wpy
28 comments
My last install involved a plain dm-crypt root with btrfs subvolumes on top of it.
During the install I took these steps for sda3:
I used plain dm-crypt, but you can use that wiki page to setup the volume however you'd like. Also follow the BTRFS wiki. Your boot entry gets a bit complex.
Ideally you'd just make a swapfile instead of a swap partition, but it doesn't work with btrfs right now. Here is how to use dm-crypt to encrypt your swap partition.
Look over the btrfs mount options. I used rw,noatime,compress=lzo,ssd,space_cache,inode_cache. If you have an SSD you may still want to leave out discard if you are encrypting the entire root volume. You do not want autodefrag on an SSD as there is no performance loss and it only performs unnecessary writes.
Question:
inode_cache?I um... I need to listen to my own advice and thoroughly read the btrfs options. Ignore that inode_cache and I'll go hide in shame.
Thanks! Btw on the encrypted swap wiki you linked to, which of the 3 options under 'with suspend to disk' did you go with?
With his set up, suspend to disk would be a pain in the ass.
Honestly, I'm in the same boat as you. I'm about to redo my laptop's partitions and I can't decide if having btrfs on top of LVM is the best option. It's probably fine, though, but you'll need a separate swap logical volume and then a btrfs logical volume, which can have subvolumes for your partitions.
I don't use suspend to disk on my system. I really only use the swap as a buffer in case compiling something with a bunch of things open and using /tmp steps over the RAM total. I either shutdown the computer or suspend to RAM, which doesn't require swap.
This might help.
I have that setup (btrfs with dm-crypt- no LVM, mbr, no uefi, grub, dual boot, no swap)
sda 8:0 0 238.5G 0 disk
├─sda1 8:1 0 350M 0 part (win boot loader)
├─sda2 8:2 0 90G 0 part (windows8.1)
├─sda3 8:3 0 250M 0 part /boot (->grub)
├─sda4 8:4 0 1K 0 part (logical partition)
├─sda5 8:5 0 140G 0 part
└─crypt 254:0 0 140G 0 crypt /
No swap, so you don't hibernate your system?
If you do choose to go the btrfs route, you should note that it does not support swap at this time. You can patch it in apparently, but it does not come out of the box.
correct - I dont see the advantage of hibernating over suspending to ram.