BTRFS wizards, what subvolume structure do you use/recommend? also some other questions
so i'm planning my new arch install and have some questions:
info: UEFI, systemd-boot, LUKS (with btrfs volumes inside) , laptop, normal use (webbrowsing, games, chatting)
so i will be using 2 partitons:
/dev/sda1 (boot partion, EFI, FAT32) - not encrypted
/dev/sda2 ( cryptsetup luksFormat --type luks2 --align-payload=8192 -s 256 -c aes-xts-plain64 /dev/sda2)
i'm using the align payload, because according to this (hot to optimise encrypted filesystems on an SSD?)
should i be using --key-size 512? one the benchmarks it appears the 256 is faster (not by much) than 512, i'm mainly trying to protect against a stolen laptop event.
inside the luks container i'm planning on using full btrfs for everything, my problem is that i dont really know whats the best options when it comes to subvolumes. do you guys just do / and home? or do create a subvol for logs too?
NEVER MIND ABOUT THE REST, I JUST FOUND THIS LINK THAT EXPLAINS THE REST:
https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#Btrfs_subvolumes_with_swap
so, via the wiki, it appears that i need to use swapfile?, but i dont really understand the part "It does not support swap files on file systems that span multiple devices." what does devices mean here? hdd/ssd or partitions? i was planning on having the swap file inside the LUKS container.
also, since the swap file cant be inside a subvolume how do you guys deal with that? do you use a new subvol just for swap inside the LUKS container?
does the good old "create new partition and swapon it) still works when dealing with luks and btrfs or i am forced to use swapfiles? (in case i want hibernation)
can i create a subvol thats "inside" another subvol? i was thinking about creating a subvol for my .config folder
Edited 1 Nov 2019. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 21 · 100% up
- Kind
- Text
- ID
- dqa5tt
6 comments
My btrfs layout:
The reason for putting snapshots in subvolumes is on the wiki. The reason for mounting the root subvolume is just for ease of access. The reason for the bind-mount for /boot is so that I can have multiple versions of the kernel on the same ESP (e.g. in /storage/esp/linux2 and /storage/esp/experiment4).
For me I boot with systemd, I have a separate swap partition that's encrypted with random key via dm-crypt. Root and home are separate subvols for snapshots. For key read up on it, xts halves the key size, the 'speed' difference's is negligible with modern SSD's, so go with 512. Rest is in the wiki..
I use and recommend the "flat" subvolume layout that is documented in the btrfs wiki. One volume per device, and every other subvolume is a subvolume of it. The root subvolume is mounted only when making snapshots for backups, and it is unmounted immediately after the backup workflow is completed (which includes sending the backup snapshots to another device for safe storage).
https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Flat
https://www.xkcd.com/538/
Subvolume layout depends on what and how you want to back up.
If you always want to back up everything, put everything into one subvolume. If you want to exclude certain parts, put those into their own subvolumes.
Reversely, if you only want to back up certain parts but not anything else put those into their own subvolumes.
You only need swap if you often have memory pressure or need hibernation.
A block device like a hard drive, a partition or a stacked blockdev like LUKS volumes.
You can add these blockdevs to a btrfs and it'll will automatically distribute its data over all the devs it owns according to the active block group mode (replication profile) that even support something similar to RAID.
Sure, just add
resume=with the unlocked LUKS device andresume_offset=with the byte of the LUKS device at which the swapfile starts (this is a bit tricky to find out with btrfs).Read https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#Hibernation for more info.
It can and should be in its own subvolume because the subvolume it's in can't be snapshotted.
Yes but it won't get snapshotted (nor sent) recursively. (This can be useful for
.cache/though for example)You should put the dotfiles you want to keep into a git repo instead, that's a much better way of keeping track of them and backing them up.
Have you tested your UEFI firmware implementation?
He's asking about btrfs advice and you jump off with his UEFI implementation.. How does this relate and what exactly do you think OP should test?