I chose to reinstall Arch Linux on BTRFS because it has some nice features: CoW (copy on write), snapshots and subvolumes.

All put together, that means that I can have a snapshot of / in a few seconds and easily go back to the snapshot in case something bad happens. I rely on snapper and snap-pac (the last one is just for arch linux) to realize this.

A key point is understanding that snapshots are taken on subvolumes, and nested subvolumes are not part of the snapshot.

I created three top-level subvolumes: @ for /, @home for /home, @snapshots for storing snapshots in /.snapshots.

Before starting, writing the Arch ISO to USB is as simple as using dd. When you boot from the key, remember to run loadkeys it or whatever keyboard layout you use.

My hard drive has GPT partition table, with the following partitions

/dev/sda1 EFI boot partition
/dev/sda2 Linux Partition

Regarding the formatting,

mkfs.vfat -F32 /dev/sda1
cryptsetup -y -v luksFormat /dev/sda2
cryptsetup open /dev/sda2 cryptroot
mkfs -t btrfs -L linuxroot /dev/mapper/cryptroot

At this point, I mount the btrfs partition and create the needed subvolumes

mount -t btrfs -o compress=lzo /dev/mapper/cryptroot /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@snapshots

At this point, I unmount the partition and mount it again with the correct subvolumes; I also create the nested subvolumes inside @ for some folders that change constantly and don’t need to be part of the snapshot (read here)

umount /mnt
mount -o compress=lzo,subvol=@ /dev/mapper/cryptroot /mnt
mkdir -p /mnt/home
mount -o compress=lzo,subvol=@home /dev/mapper/cryptroot /mnt/home
mkdir -p /mnt/.snapshots
mount -o compress=lzo,subvol=@snapshots /dev/mapper/cryptroot /mnt/.snapshots
mkdir -p /var
btrfs subvolume create /mnt/var/tmp
btrfs subvolume create /mnt/tmp

Finally, mount the EFI partition (it won’t be part of the snapshot, even if mounted, because it’s not in BTRFS)

mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot

Now everything is ready for the installation! Run wifi-menu and then pacstrap /mnt base btrfs-progs refind-efi.

After all packages are installed,

genfstab -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt

Modify /etc/mkinitcpio.conf by adding encrypt before filesystems inside the HOOKS section.

Note to self: since I use a ex-110 logitech keyboard, I also need hid-logitech-hidpp inside MODULES.

At this point, run mkinitcpio -p linux. Then, configure a few files

echo computer_name > /etc/hostname
ln -s /usr/share/zoneinfo/Europe/Rome /etc/localtime

Uncomment the italian language in /etc/locale.gen and run locale-gen. In /etc/locale.conf, write


Now passwd sets the root password.

It’s now time for installing the rEFInd bootloader

refind-install --usedefault /dev/sda

I need --usedefault because my bios doesn’t like non-standard paths for the efi loader. I now modify refind.conf inside /boot/efi/BOOT

menuentry Arch Linux {
    icon /EFI/BOOT/refind/icons/os_arch.png
    loader vmlinuz-linux
    initrd initramfs-linux.img
    options "ro cryptdevice=UUID=INSERT_UUID_HERE:cryptroot root=/dev/mapper    /cryptroot rootflags=subvol=@"

The UUID can be found from blkid and it’s the one of /dev/sda2, not /dev/mapper/cryptroot.

Regarding the configuration of snapper, run snapper -c root create-config / (always inside the chroot, with the correct subvolumes mounted). It may be possible that snapper gives some error, I honestly forgot (more info here).

A GUI program snapper-gui is available from AUR.

The guide stops here! In the following, I just add a few notes for myself (packages I install).

Since I use KDE, I need

pacman -S plasma-desktop sddm plasma-nm xorg-server xf86-video-ati kde-l10n-it pulseaudio plasma-pa zsh emacs kdegraphics-okular dolphin sudo ark unzip unrar p7zip zip wget snappy rsync base-devel thunderbird gparted print-manager cups ghostscript gs cups-pdf sane xsane hplip


comments powered by Disqus