BTRFS As a Dropdown Filesystem Option During Install

Hi,

I’ve used Linux before, and have a technical background (in hardware), but when it comes to shell commands, I’m definitely a n00b. I would love to have the option to format the HDD/SSD to BTRFS during the install of PureOS. It has a lot of advantages that make it really compelling especially when using multiple hard drives.

With that being said, it is not currently an option, but I would like to set up an install onto BTRFS, and would appreciate any help pointing me in the right direction. Ideally I would like to use LUKS as well in a way that doesn’t diminish the advantages of using this filesystem, which throws another loop into the shell commands that I know will be a pain to figure out.

I am getting familiar right now with the associated commands, but it feels discouraging that there is such a big learning curve to just get the distro completely installed onto this filesystem. At least if I knew how to get up and running, I could learn how to play around with it more easily.

Is it advisable to have /boot in EXT4 like I’ve seen most other solutions, or could I potentially make it uniform the whole way through so I could extend it’s advantages all the way down to the entire operating system?

1 Like

You can certainly install onto btrfs, no secondary filesystem needed (for legacy boot, EFI boot needs a FAT partition).

For whole disk usage, it’s going to be some variant of

parted /path/to/drive (probably /dev/sda)

Then, within parted

mklable msdos
mkpart primary 32mib 100%
set 1 boot on
p

Verify the table printed out looks sane (should be a single entry, starting at 33.6MB, should have the boot flag).

Then type q to quit
Refresh the partition table in the kernel via

partprobe /path/to/drive (probably /dev/sda)

To make the filesystem, use

mkfs.btrfs /path/to/drive1 (probably /dev/sda1)

Then you can mount the drive wherever your installer expects it and go on like normal.

LUKS is a separate step, but you should be able to composite them easily. After making your LUKS device, with whatever encryption you want, unlock the device, and use the above steps, but instead of pointing at the underlying hardware, point at the LUKS device. So the above commands will be something like btrfs.mkfs /dev/mapper/myEncryptedDrive1.

In this case, unless you get a boot loader with the ability to interface both with BTRFS and with your encryption system, you’ll need to put the kernel and initramfs outside the encrypted volume. Also, the initramfs will need to be configured to call luksOpen, and collect the password from the user. It’s not super difficult, but it does take some care to get it right. The btrfs layer on top is pretty trivial by comparison.

All that said, have you considered just encrypting your home partition? The Librem laptops are not exactly cutting edge hardware, and encrypting the disk will significantly slow system performance. Also, it’s much easier to get a system with just the home partition encrypted up and running, and much easier to rescue boot it when something breaks.

3 Likes

“butter”-fs or “better”-fs is next gen ext4 …