Wednesday, December 2, 2026

Fedora 45 Server OverlayFS BTRFS/XFS setup

The flawless execution of Anaconda's storage upload and configuration phase for complex Btrfs/XFS layouts in the Fedora 45 Server release versus the buggy behavior in Beta versions stems primarily from a structural shift in how Anaconda queues and processes complex storage actions.
In the Final F45 Release: Blivet received critical stabilization patches to properly sync, lock, and isolate sequential tasks. The "uploading phase" now strictly ensures that block layer mappings (dm-thin, LUKS, and Btrfs top-level pools) are fully committed and recognized by the kernel before nested subvolumes or XFS formatting operations are fired. The execution phase in Beta versions frequently ran into early-boot hangs and formatting timeouts because Anaconda’s action loop didn’t sleep long enough to let udevd finalize the block symlinks for complex layouts. The final GA (General Availability) release integrated better polling loops, forcing the upload phase to dynamically pause until the environment's storage tables settled, resulting in a smooth write phase. 

 Final disk layout

  boris@fedora45Server:~$ hostnamectl
    Static hostname: fedora45Server
          Icon name: computer-desktop
            Chassis: desktop 🖥
  Chassis Asset Tag: To be filled by O.E.M.
         Machine ID: a7e6ea1c6fbe4e9b97eebc36abb5b731
            Boot ID: 3ee732d6e51e426ba8de040ab4282f81
   Operating System: Fedora Linux 45 (Server Edition)
        CPE OS Name: cpe:/o:fedoraproject:fedora:45
     OS Support End: Wed 2027-12-08
OS Support Remaining: 1y 5d                              
             Kernel: Linux 7.3.6-300.fc45.x86_64
       Architecture: x86-64
    Hardware Vendor: Micro-Star International Co., Ltd.
     Hardware Model: MS-7C37
   Hardware Version: 3.0
   Firmware Version: H.60
      Firmware Date: Wed 2019-11-06
       Firmware Age: 7y 3w 5d                           
 

boris@fedora45Server:~$ findmnt -t btrfs
TARGET        SOURCE                       FSTYPE OPTIONS
/             /dev/nvme0n1p4[/@]           btrfs  rw,relatime,seclabel,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=285,subvol=/@
├─/home       /dev/nvme0n1p4[/@home-0]     btrfs  rw,relatime,seclabel,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home-0
├─/.snapshots /dev/nvme0n1p4[/snapshots-0] btrfs  rw,relatime,seclabel,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/snapshots-0
├─/var/cache  /dev/nvme0n1p4[/@cache-0]    btrfs  rw,relatime,seclabel,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/@cache-0
└─/var/log    /dev/nvme0n1p4[/@log-0]      btrfs  rw,relatime,seclabel,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@log-0

 
boris@fedora45Server:~$ df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/nvme0n1p4 btrfs     200G  7.8G  192G   4% /
devtmpfs       devtmpfs  4.0M     0  4.0M   0% /dev
tmpfs          tmpfs      16G   92K   16G   1% /dev/shm
efivarfs       efivarfs  128K   27K   97K  22% /sys/firmware/efi/efivars
tmpfs          tmpfs     6.3G  2.1M  6.3G   1% /run
none           tmpfs     1.0M     0  1.0M   0% /run/credentials/systemd-journald.service
none           tmpfs     1.0M     0  1.0M   0% /run/credentials/systemd-resolved.service
/dev/nvme0n1p4 btrfs     200G  7.8G  192G   4% /.snapshots
/dev/nvme0n1p4 btrfs     200G  7.8G  192G   4% /home
tmpfs          tmpfs      16G  8.0K   16G   1% /tmp
/dev/nvme0n1p4 btrfs     200G  7.8G  192G   4% /var/cache
/dev/nvme0n1p4 btrfs     200G  7.8G  192G   4% /var/log
/dev/nvme0n1p2 ext4      3.9G  475M  3.2G  13% /boot
/dev/nvme0n1p3 xfs       256G  5.0G  251G   2% /opt
/dev/nvme0n1p1 vfat      599M  8.0M  591M   2% /boot/efi
tmpfs          tmpfs     3.2G   96K  3.2G   1% /run/user/1000
tmpfs          tmpfs     3.2G   40K  3.2G   1% /run/user/0


boris@fedora45Server:~$ lsblk -f
NAME                                FSTYPE      FSVER    LABEL         UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
sr0                                                                                                                           
zram0                               swap        1        zram0         2aeccc50-ff57-4e76-a766-b8ecfe99eb23                  [SWAP]
nvme0n1                                                                                                                       
├─nvme0n1p1                         vfat        FAT32                  9E90-A572                               590.9M     1% /boot/efi
├─nvme0n1p2                         ext4        1.0                    6d5d3508-d4a4-4fae-bf2e-9ffc4c98f5c4      3.2G    12% /boot
├─nvme0n1p3                         xfs                                ff2da0c2-b033-4be3-b0e1-31731b34affe    250.9G     2% /opt
└─nvme0n1p4                         btrfs                fedora_volume a36fa7c4-c350-4d6d-b943-3e52c969739b    191.9G     4% /var/log
                                                                                /var/cache
                                                                                 /home

                                                                                 /.snapshots
                                                                                  /

=========================

OverlayFS BTRFS/XFS setup

=========================

$ sudo dnf install btrfs-assistant snapper gawk inotify-tools libdnf5-plugin-actions git make -y
$ sudo dnf install python3-btrfsutil dracut-live -y 

========================
Trick Snapper Method
========================
$ sudo umount /.snapshots
$ sudo rmdir    /.snapshots
$ sudo snapper -c root create-config  /
$ sudo mount  /.snapshots

Create the missing directory: 

$ sudo mkdir -p /boot/grub
$ sudo dnf install grub2-tools 

# Fix binary compatibility wrapper
$ sudo ln -sf /usr/bin/grub2-script-check /usr/bin/grub-script-check
$ cd grub-btrfs
 
================
UNDER grub-config
================
$ nano config
GRUB_BTRFS_MKCONFIG="/usr/bin/grub2-mkconfig"
GRUB_BTRFS_GRUB_DIRNAME="/boot/grub2"
GRUB_BTRFS_SCRIPT_CHECK="grub2-script-check"
===========================================

# Compile package targets
$ sudo make install 
 
===============================
sudo nano /etc/default/grub-btrfs/config
===============================
GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS=
="'rd.live.overlay.overlayfs=1'" 
==============================
 Overlay Setup
==============================
$ echo 'add_dracutmodules+=" overlayfs "' | sudo tee /etc/dracut.conf.d/overlayfs.conf
$ sudo dracut -f --regenerate-all
$ sudo rm -f /boot/grub2/grub-btrfs.new /tmp/grub-btrfs.*
$ sudo /etc/grub.d/41_snapshots-btrfs
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
$ sudo systemctl daemon-reload
$ sudo systemctl enable --now grub-btrfsd
 
============================================
 Setup KDE Plasma 6.8.3 on top of Fedora 45 Server (*)

=========================================== 

sudo dnf install -y @kde-desktop-environment
echo "export KWIN_FORCE_SW_CURSOR=1" | sudo tee /etc/profile.d/kwin-software-cursor.sh
sudo chmod +x /etc/profile.d/kwin-software-cursor.sh
sudo dnf install -y dbus-daemon plasma-workspace-wayland
sudo systemctl stop kmscon
sudo systemctl disable kmscon
KWIN_FORCE_SW_CURSOR=1 dbus-run-session startplasma-wayland

GDM may be used to automate login and logout to KDE Plasma 6.8.3 running on top of Fedora 45 server 

Main instance recovery via Overlay instances available via Grub Sub-menu follows known guide lines 



REFERENCES

(*) Assisted by Google AI 

 P.S. Disaster recovery script via Overlay instance

#!/bin/bash
# -------------------------------------------------------------------------
# BTRFS-RECOVERY-WIZARD: Safe Interactive Rollback Tool with Dry-Run Mode
# -------------------------------------------------------------------------
set -euo pipefail

# Hardware & Layout Configurations
DEV="/dev/nvme1n1p4"
MNT_POINT="/mnt/btrfs-top"
DRY_RUN=true

# Formatting helpers
echo_blue()   { echo -e "\033[1;34m$1\033[0m"; }
echo_green()  { echo -e "\033[1;32m$1\033[0m"; }
echo_yellow() { echo -e "\033[1;33m$1\033[0m"; }
echo_red()    { echo -e "\033[1;31m$1\033[0m"; }

# 1. Enforcement Check
if [ "$EUID" -ne 0 ]; then
    echo_red "[-] Error: This recovery wizard must be run as root/sudo."
    exit 1
fi

echo_blue "=========================================================="
echo_blue "BTRFS LIVE OVERLAYFS SYSTEM RECOVERY WIZARD"      
echo_blue "=========================================================="

# 2. Mode Selection Menu
echo "Select Execution Mode:"
echo "1) Safe Dry-Run Mode (Preview changes without writing to disk)"
echo "2) Production Live Mode (Execute actual subvolume recovery)"
read -rp "Enter choice [1-2]: " MODE_CHOICE

if [ "$MODE_CHOICE" -eq 2 ]; then
    DRY_RUN=false
    echo_yellow "[!] WARNING: Production Live Mode selected! Changes will be written to disk."
else
    DRY_RUN=true
    echo_green "[*] Safe Dry-Run Mode activated. No disk changes will occur."
fi

# 3. Mount top-level tree to parse snapshots
echo_blue "\n[Step 1/5] Mounting Btrfs SubvolID=5 partition layout..."
if [ "$DRY_RUN" = true ]; then
    echo_green "[DRY-RUN] Command: mkdir -p $MNT_POINT"
    echo_green "[DRY-RUN] Command: mount -o subvolid=5 $DEV $MNT_POINT"
else
    mkdir -p "$MNT_POINT"
    if ! mountpoint -q "$MNT_POINT"; then
        mount -o subvolid=5 "$DEV" "$MNT_POINT"
    fi
fi

# 4. Interactive Snapshot Parsing
echo_blue "\n[Step 2/5] Available Snapper Timelines Target Pools:"
if [ "$DRY_RUN" = true ]; then
    echo_green "[DRY-RUN] Displaying current live snapshots list for preview:"
    # Temporarily mount read-only to show user choices during a dry-run
    TMP_MNT=$(mktemp -d)
    mount -o subvolid=5,ro "$DEV" "$TMP_MNT"
    btrfs subvolume list "$TMP_MNT" | grep "snapshots-0/" || true
    umount "$TMP_MNT" && rmdir "$TMP_MNT"
else
    btrfs subvolume list "$MNT_POINT" | grep "snapshots-0/" || true
fi

echo_yellow "\nEnter the target SNAPSHOT ID number you wish to restore as the new root (e.g., 12):"
read -rp "Recovery Target ID: " RECOVERY_ID

# Verify paths based on your Anaconda Blivet 'snapshots-0' layout format
SOURCE_SNAP="snapshots-0/${RECOVERY_ID}/snapshot"

# 5. Core Execution Stage (Simulated vs Real)
echo_blue "\n[Step 3/5] Evaluating Root Subvolume Reconfiguration Layer..."
if [ "$DRY_RUN" = true ]; then
    echo_green "[DRY-RUN] Target subvolume source: $MNT_POINT/$SOURCE_SNAP"
    echo_green "[DRY-RUN] Action: mv $MNT_POINT/@ $MNT_POINT/@_broken_$(date +%Y%m%d)"
    echo_green "[DRY-RUN] Action: btrfs subvolume snapshot $MNT_POINT/$SOURCE_SNAP $MNT_POINT/@"
else
    if [ ! -d "$MNT_POINT/$SOURCE_SNAP" ]; then
        echo_red "[-] Error: Snapshot directory '$MNT_POINT/$SOURCE_SNAP' does not exist."
        umount "$MNT_POINT" || true
        exit 1
    fi

    TIMESTAMP=$(date +%Y%m%d_%H%M%S)
    echo_yellow "[+] Moving active broken root subvolume '@' to '@_broken_${TIMESTAMP}'..."
    mv "$MNT_POINT/@" "$MNT_POINT/@_broken_${TIMESTAMP}"

    echo_yellow "[+] Generating clean clone from Snapshot ${RECOVERY_ID} directly into '@' slot..."
    btrfs subvolume snapshot "$MNT_POINT/$SOURCE_SNAP" "$MNT_POINT/@"
fi

# 6. Unmount Layer
echo_blue "\n[Step 4/5] Flushing transaction caches..."
if [ "$DRY_RUN" = true ]; then
    echo_green "[DRY-RUN] Command: umount $MNT_POINT"
else
    umount "$MNT_POINT"
    echo_green "[+] Raw partition structure successfully unmounted."
fi

# 7. Finalization Banner
echo_blue "\n[Step 5/5] Finalizing State Execution Matrix..."
if [ "$DRY_RUN" = true ]; then
    echo_green "=========================================================="
    echo_green "     DRY-RUN COMPLETE: No structural errors found in pipeline.   "
    echo_green "=========================================================="
else
    echo_green "=========================================================="
    echo_green "     RECOVERY COMPLETE: Snapshot ${RECOVERY_ID} is now promoted to root. "
    echo_green "     Please issue 'sudo reboot' to initialize clean system state. "
    echo_green "=========================================================="
fi