niels / Blog / #linux

Tweaking Elementary OS

Heads up! This post is more than a year old.

Elementary OS has been my favorite desktop distribution for the past 2 years or so. Its out-of-the-box experience is very close to my preferred setup. Nothing is perfect though. Below are the tweaks I apply when installing Elementary OS 6.

BTRFS

The default Elementary OS install uses an encrypted ext4 partition. If you want to use encrypted btrfs, you’re out of luck. The Custom Install will let you use btrfs, but not encrypted btrfs. My work-around is very simple, if a bit tedious.

Default install

First run the default install like you would normally do. This erases your disk and sets you up with an encrypted ext4 partition.

Open Encryption

Boot the installer once more. This time, choose a Custom Install. Choose to manage your disks, which fires up gparted. Use gparted to Open Encryption on the encrypted partition. (You could do this on the command-line, but this is quick and easy.)

Convert to btrfs

Exit gparted and go backwards in the installer. Now choose to enter the Demo mode and open a Terminal.

Enter the following command to convert the ext4 root to btrfs:

sudo btrfs-convert /dev/mapper/data-root

This takes only a minute or so on a clean install.

Update /etc/fstab

Before rebooting, we’ll need to update /etc/fstab. To access the file, we first mount our newly converted btrfs filesystem:

sudo mount /dev/mapper/data-root /mnt

We then determine the new blkid of the btrfs filesystem:

sudo blkid /dev/mapper/data-root

It will show you two ID’s, you need the first one:

sudo blkid /dev/mapper/data-root 
[sudo] password for niels:         
/dev/mapper/data-root: UUID="dba6ca21-79e0-49c9-b889-c37d2ccb446a" UUID_SUB="27c5452a-7878-4357-8f95-596a08cab55b" TYPE="btrfs"

Now use your favorite text editor to update /etc/fstab:

PARTUUID=48e067c9-0a5e-4ad7-acb6-2313973188d6  /boot/efi  vfat  umask=0077  0  0
UUID=da66e7aa-9162-4550-b527-514a045759b0  /boot  ext4  noatime,errors=remount-ro  0  0
UUID=dba6ca21-79e0-49c9-b889-c37d2ccb446a  /  btrfs  defaults,noatime,autodefrag,compress  0  0
/dev/mapper/data-swap  none  swap  defaults  0  0

Two things have been updated:

  1. The UUID, as obtained with blkid.
  2. The options changed from noatime,errors=remount-ro to defaults,noatime,autodefrag,compress

Reboot

You should now be able to reboot into your Elementary OS install.

0 comments