Sunday, July 12, 2026

Setup non-flat btrfs architecture on Arch Linux via CachyOS approach

 UPDATE as of 07/13/26 

Arch Linux is supposed to be preinstalled with default BTRFS Configuration and Snapper via archinstall --advanced

$ lsblk -f
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sr0
zram0  swap   1     zram0 049597e2-0935-4472-9087-156e7af672f1                [SWAP]
vda
├─vda1 vfat   FAT32       389E-C9B6      912.9M    11%   /boot
└─vda2 btrfs              bd32bc49-c8fb-4275-885b-51b9fb7aaae3   62.2G    15%  /home
                                                                 /var/log
                                                                 /var/cache/pacman/pkg
                                                                  / 

END UPDATE 

The first phase follows exactly guidelines proposed in Bring CachyOS KDE Plasma 6.7.2 along with kernel 7.1.3 to Arch Linux  

Second phase was developed in collaboration with Google AI Assistant.
Goals achieved in second phase:
1. Package Independence: Installing only btrfs-assistant  and grub-btrfs completely bypasses the CachyOS              configuration meta-packages, keeping Limine off.
2. Predictable mkinitcpio Execution: Cleaning the              BOOTX64.EFI fallback slots before running                        mkinitcpio -P ensures  that the subsequent grub-install    execution writes a clean binary to an empty path.                3.Precise Target Identification:
Pointing --efi-directory directly to /boot accurately reflects 1 GB default FAT32 layout . 

$ sudo pacman -S --noconfirm btrfs-assistant grub-btrfs

Systemd, sd-vconsole switches the initramfs boot environment from a classic BusyBox script setup over to a systemd-managed process.

The systemd hook completely replaces both base and udev. It builds an initramfs that starts a mini-systemd instance to handle device discovery and orchestration instead of relying on older BusyBox shell scripts. Without base, you drop the traditional BusyBox emergency recovery shell. If the system undergoes a catastrophic boot failure, you will instead drop into a systemd-managed emergency shell. Because microcode is listed after autodetect in your configuration,
mkinitcpio will only pack the microcode matching your specific local processor model. If you had placed it before autodetect, it would build a universal image containing every Intel and AMD microcode patch available. This permits you to completely strip out any initrd=...-ucode.img references out of your bootloader configuration (like systemd-boot or GRUB) because the microcode is safely nested directly inside the unified image. HOOKS below represents a modern, optimized, pure systemd-based initramfs layout that strips away legacy configuration defaults

$ sudo sed -i 's/^HOOKS=(.*/HOOKS=(systemd autodetect microcode modconf kms keyboard sd-vconsole block filesystems fsck)/' /etc/mkinitcpio.conf
###  Clean up ######
$ sudo rm -f /boot/EFI/BOOT/BOOTX64.EFI
$ sudo rm -f /boot/EFI/BOOT/bootx64.efi
#################
$ sudo mkinitcpio -P
$ sudo grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub --recheck
$ sudo grub-install --target=x86_64-efi --efi-directory=/boot --removable --recheck ( required only in VENV )
$ sudo systemctl enable --now grub-btrfsd.service
$ sudo grub-mkconfig -o /boot/grub/grub.cfg












[boris@ArchLinux0712 ~]$ uname -a
Linux ArchLinux0712 7.1.3-2-cachyos #1 SMP PREEMPT_DYNAMIC Wed, 08 Jul 2026 18:34:01 +0000 x86_64 GNU/Linux
[boris@ArchLinux0712 ~]$ df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/vda2      btrfs      74G  9.5G   64G  14% /
devtmpfs       devtmpfs  7.6G     0  7.6G   0% /dev
tmpfs          tmpfs     7.7G     0  7.7G   0% /dev/shm
efivarfs       efivarfs  256K   73K  179K  29% /sys/firmware/efi/efivars
tmpfs          tmpfs     3.1G  1.2M  3.1G   1% /run
none           tmpfs     1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
tmpfs          tmpfs     7.7G  4.0K  7.7G   1% /tmp
/dev/vda2      btrfs      74G  9.5G   64G  14% /home
/dev/vda2      btrfs      74G  9.5G   64G  14% /var/cache/pacman/pkg
/dev/vda2      btrfs      74G  9.5G   64G  14% /var/log

/dev/vda1      vfat     1022M  110M  913M  11% /boot
tmpfs          tmpfs     1.6G   40K  1.6G   1% /run/user/1000
[boris@ArchLinux0712 ~]$ findmnt /
TARGET SOURCE        FSTYPE OPTIONS
/      /dev/vda2[/@] btrfs  rw,relatime,compress=zstd:3,discard=async,space_cache=v2,subvolid=273,subvol=/@
[boris@ArchLinux0712 ~]$ findmnt /var/log
TARGET   SOURCE           FSTYPE OPTIONS
/var/log /dev/vda2[/@log] btrfs  rw,relatime,compress=zstd:3,discard=async,space_cache=v2,subvolid=258,subvol=/@log
[boris@ArchLinux0712 ~]$ findmnt /home
TARGET SOURCE            FSTYPE OPTIONS
/home  /dev/vda2[/@home] btrfs  rw,relatime,compress=zstd:3,discard=async,space_cache=v2,subvolid=257,subvol=/@home
[boris@ArchLinux0712 ~]$ sudo btrfs subvolume list /
[sudo] password for boris:
ID 256 gen 164 top level 5 path @_backup_2026-07-12T08:50:28.780Z
ID 257 gen 206 top level 5 path @home
ID 258 gen 210 top level 5 path @log
ID 259 gen 198 top level 5 path @pkg

ID 260 gen 14 top level 273 path var/lib/portables
ID 261 gen 14 top level 273 path var/lib/machines
ID 262 gen 208 top level 273 path .snapshots
ID 263 gen 207 top level 257 path @home/.snapshots
ID 264 gen 49 top level 263 path @home/.snapshots/1/snapshot
ID 265 gen 49 top level 262 path .snapshots/1/snapshot
ID 266 gen 140 top level 262 path .snapshots/2/snapshot
ID 267 gen 141 top level 262 path .snapshots/3/snapshot
ID 268 gen 143 top level 262 path .snapshots/4/snapshot
ID 269 gen 162 top level 262 path .snapshots/5/snapshot
ID 270 gen 178 top level 5 path @_backup_2026-07-12T08:55:30.375Z
ID 271 gen 187 top level 262 path .snapshots/6/snapshot
ID 272 gen 191 top level 5 path @_backup_2026-07-12T17:38:26.467Z
ID 273 gen 209 top level 5 path @
ID 274 gen 206 top level 263 path @home/.snapshots/2/snapshot
ID 275 gen 207 top level 262 path .snapshots/7/snapshot


No comments:

Post a Comment