From Fedora Project Wiki


Improve the Anaconda Btrfs preset

Summary

A few small changes will make it easier to do snapshots and rollbacks on btrfs.

Owner

  • Name: Chris Murphy
  • Email: chrismurphy@fedoraproject.org
  • Product: Anaconda
  • Responsible WG: Workstation, KDE SIG

Current status

  • Targeted release: Fedora 33
  • Last updated: 2020-06-13
  • FESCo issue: <will be assigned by the Wrangler>
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

System boot, root, and home will use btrfs for default installations using the Custom installation preset. [1]

Btrfs subvolumes mostly behave like directories. They have no free space size of their own, free space is shared with the file system. And yet, they can be snapshot, and be reused when reinstalling, e.g. it is possible keep an existing /home directory on clean install.

Compared to the current preset, the change suggests adding subvolumes for the following mountpoints: /etc /var /opt /root/root /srv /usr/local

[1] /boot on btrfs is supported by GRUB for ~10 years; enables snapshotting of /boot to ensure parity with /usr on rollback; needs design review and resource assessment.

Feedback

Lorem ipsum ...

Benefit to Fedora

Make the default btrfs installation a little more optimized for today's use cases, and better prepared for future use cases. Btrfs makes advanced file system features available to user and developers for opt in usage, without requiring regular users to learn esoteric file system commands. e.g. df will continue to correctly report used/free space. And no manual maintenance rituals are needed.

Features enabled by default:

  • File system metadata and data integrity checking
  • Podman can use snapshots (default) or reflinks+overlayfs, at user discretion. Both are faster and more space efficient operations, than copy up on ext4.
  • Flatpaks will be compressed by default.

Optional features by CLI right now (future integration opportunities in GUI):

  • Enable/disable compression per file/directory (GNOME Files, KDE Konqueror)
  • Online shrink and grow (GNOME Disks, KDE Partition Manager)
  • Subvolumes, snapshots, restore files by reflink copy (GNOME Files, KDE Konqueror)

Scope

  • Proposal owners:
    • Implement /boot on dedicated ~1.5G btrfs volume with 'boot' subvolume
    • Design a subvolume layout focusing on snapshot and rollback functionality, and modify the btrfs preset kickstart accordingly.
    • Enhance flatpak to set chattr +c on system and user flatpak directories
  • Other developers:
    • Bootloader team to review and ack changes.
    • Anaconda to review and merge changes.
    • Flatpak developers to review and merge above changes.
    • Might affect dnf snapper plugin behavior.
  • Policies and guidelines: N/A
  • Trademark approval: N/A

Upgrade/compatibility impact

This change will not apply to upgrades.

How To Test

Install and use the system however you usually do, and it should behave the same.

User Experience

  • Transparent in normal use.
  • Corruption detected in data results in EIO. Corrupt data is never handed over to applications, unlike other file systems. Kernel messages will report an error and path to the affected file(s) so they can be replaced with known good copies.
  • Better space utilization for containers and flatpaks.
  • Users can opt-in to most btrfs features: snapshots, compression, cp --reflink efficient copies, online scrub, btrfs send/receive

Dependencies

None

Contingency Plan

  • Contingency deadline: Revert all changes.
  • Blocks release? Yes.
  • Blocks product? Workstation/KDE are release blocking desktops.

Documentation

The user is not expected to know btrfs specific things for day to day use.

man 5 btrfs - for information about general btrfs information, mount options, and features.
man btrfs - for information about the btrfs command and sub commands. NOTE: Subcommands can be arbitrarily shortened, as long as it isn't ambiguous. 'btrfs fi us' is the same as 'btrfs filesystem usage'.

Release Notes