Monday, July 20, 2026

Setup non-flat btrfs architecture on Garuda Linux (VENV)

Garuda Linux advantages which are provided by btrfs
Automated Snapshots :  Creates system snapshots automatically before every update. Uses grub-btrfs for this setup. Allows booting into old snapshots from boot menu. Fixes broken updates easily without using live USBs. Storage Efficiency :   Saves disk space using transparent zstd compression. Increases the lifespan of SSDs.  Loads heavy applications much faster due to compression. Shares free space dynamically between root and home. Copy-on-Write Performance :  Copies massive files instantly without duplicating physical data. Creates instant subvolume backups using minimal disk writes. Prevents file corruption during unexpected power losses.  Modifies data safely by writing changes to new blocks.

   Garuda features the Zen kernel, which is tuned for system responsiveness and lower latency. It includes the Garuda Gamer tool, which allows you to install game platforms (like Steam, Lutris, and Wine) with a single click
 

Default disk layout

╭─boris@boris-devs0720 
╰─λ lsblk -f
NAME   FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sr0                                                                            
zram0  swap   1     zram0 22125e49-fcc2-44b0-9674-b7537907c799                [SWAP]
vda                                                                            
├─vda1 vfat   FAT32       7246-2916                             298.7M     0% /boot/efi
└─vda2 btrfs              f886b994-b933-42f9-b7da-82f9bb54b15b   61.4G    17%             /var/tmp
                                                                             /var/log
                                                                             /var/cache
                                                                             /root
                                                                             /home
                                                                             /srv
                                                                             /

Required command's set for btrfs system support

$ sudo pacman -S inotify-tools
$ sudo systemctl enable --now grub-btrfsd
$ sudo grub-mconfig -o /boot/grub/grub.cfg
$ sudo pacman -S snap-pac 
$ paru -S snap-pac-grub
 
╭─boris@boris-devs0720 
╰─λ df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/vda2      btrfs      75G   13G   62G  17% /
devtmpfs       devtmpfs  7.6G     0  7.6G   0% /dev
tmpfs          tmpfs     7.7G     0  7.7G   0% /dev/shm
efivarfs       efivarfs  256K   61K  191K  25% /sys/firmware/efi/efivars
tmpfs          tmpfs     3.1G  1.3M  3.1G   1% /run
none           tmpfs     1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
/dev/vda2      btrfs      75G   13G   62G  17% /srv
/dev/vda2      btrfs      75G   13G   62G  17% /home
tmpfs          tmpfs     7.7G  9.3M  7.7G   1% /tmp
/dev/vda2      btrfs      75G   13G   62G  17% /root
/dev/vda2      btrfs      75G   13G   62G  17% /var/cache
/dev/vda2      btrfs      75G   13G   62G  17% /var/log
/dev/vda2      btrfs      75G   13G   62G  17% /var/tmp
/dev/vda1      vfat      300M  664K  299M   1% /boot/efi
tmpfs          tmpfs     1.6G   76K  1.6G   1% /run/user/1000

╭─boris@boris-devs0720 s
╰─λ sudo btrfs subvolume list /
[sudo] password for boris:              
ID 256 gen 234 top level 5 path @_backup_2026-07-19T19:04:08.884Z
ID 257 gen 330 top level 5 path @home
ID 258 gen 319 top level 5 path @root
ID 259 gen 23 top level 5 path @srv
ID 260 gen 239 top level 5 path @cache
ID 261 gen 330 top level 5 path @log
ID 262 gen 323 top level 5 path @tmp
ID 263 gen 291 top level 275 path .snapshots
ID 264 gen 66 top level 263 path .snapshots/1/snapshot
ID 265 gen 130 top level 263 path .snapshots/2/snapshot
ID 266 gen 159 top level 263 path .snapshots/3/snapshot
ID 267 gen 163 top level 263 path .snapshots/4/snapshot
ID 268 gen 187 top level 263 path .snapshots/5/snapshot
ID 269 gen 193 top level 263 path .snapshots/6/snapshot
ID 270 gen 221 top level 263 path .snapshots/7/snapshot
ID 271 gen 272 top level 5 path @_backup_2026-07-19T19:19:17.057Z
ID 272 gen 260 top level 263 path .snapshots/8/snapshot
ID 273 gen 293 top level 5 path @_backup_2026-07-19T19:25:12.875Z
ID 274 gen 282 top level 263 path .snapshots/9/snapshot
ID 275 gen 330 top level 5 path @
 
====================================================
How Snapper / Btrfs Assistant Avoids the Trap per Google AI Assistant
====================================================
 
When you booted into the GRUB sub-menu via the "rw" overlay and hit "Restore" in Btrfs Assistant, the system did not just move @.
1) It executed a specific dance to preserve the nested .snapshots subvolume structure:
Creates a Read-Write Clone Outside the Tree:   It creates a brand-new, independent read-write subvolume from your chosen snapshot directly at the root of the disk (ID 5), usually naming it something like @_backup_2026-07-19... as a staging step.
 
2) The Unmount and Swapping Dance:   It moves the broken @ to a backup name (e.g., @_old). It creates a brand new, empty directory at /mnt/@.
Crucial Step:  It safely moves or recreates the .snapshots directory/subvolume linkage out of the old directory and anchors it directly inside the brand-new
/mnt/@/.snapshots mount point.
 
3) Flips the Default Subvolume:   It copies or links the target snapshot data into the new @ while keeping the .snapshots subvolume nested cleanly underneath it, ensuring Snapper's IDs still match the filesystem tree perfectly.Because the GRUB environment used an overlayfs "rw" trick
 
4) Btrfs Assistant had the tracking freedom to manipulate these underlying directory nodes and subvolume paths on disk without the actual active root filesystem locking the files down as "busy."
 
╭─boris@boris-devs0719 in ~ as 🧙 took 0s
╰─λ pacman -Qs 'mkinitcpio|dracut'
local/dracut 111-1
    An event driven initramfs infrastructure
local/garuda-dracut-support 1.6.0-2
    Dracut support for Garuda Linux
Package output confirms exactly that  Garuda installation is already using dracut rather than mkinitcpio. Because garuda-dracut-support is handling
system, and is already utilizing a modern, parallelized, systemd-driven initramfs engine, exactly like CachyOS. 
 













Recoveries been tested via Garuda Grub submenu  from emulated crashes 1) "sudo rm -fr /usr/lib/modules"   2) "sudo rm -fr /usr/bin"

No comments:

Post a Comment