Skip to content

fix: allocate full VG size to root LV when using Btrfs subvolumes on LVM - #4856

Open
Kolgrim33 wants to merge 1 commit into
archlinux:masterfrom
Kolgrim33:fix/lvm-btrfs-subvol-layout
Open

Kolgrim33 wants to merge 1 commit into
archlinux:masterfrom
Kolgrim33:fix/lvm-btrfs-subvol-layout

Conversation

@Kolgrim33

Copy link
Copy Markdown

PR Description:

When Btrfs with default subvolumes is selected in suggest_lvm_layout(), home_volume is set to False because @home is created as a subvolume on the root logical volume.

However:

  1. suggest_lvm_layout() unconditionally calculated root_vol_size = process_root_partition_size(total_vol_available, ...) (which caps the root volume at 20–50 GiB) and discarded home_vol_size, leaving the rest of the LVM volume group unallocated.
  2. root_vol was assigned mountpoint=Path('/') even when using_subvolumes was True (unlike suggest_single_disk_layout(), which sets mountpoint=Path('/') if not using_subvolumes else None).
  3. DiskLayoutConfiguration.has_default_btrfs_vols() only checked self.device_modifications partitions and did not check self.lvm_config.get_all_volumes(), preventing Btrfs snapshot options from being enabled on LVM + Btrfs subvolume layouts.

This PR fixes all three issues and adds a unit test in tests/test_lvm_btrfs_layout.py.

Tests and Checks

  • I have tested the code!

When Btrfs with default subvolumes is selected in suggest_lvm_layout(),
home_volume is set to False because @home is created as a subvolume on
the root logical volume.

However, suggest_lvm_layout() unconditionally sized root_vol using
process_root_partition_size() (capped at 20-50 GiB) and discarded
home_vol_size, leaving the rest of the volume group unallocated. It also
set mountpoint=Path('/') on root_vol even when Btrfs subvolumes were
used, and DiskLayoutConfiguration.has_default_btrfs_vols() did not check
LVM volumes.

When home_volume is False, allocate total_vol_available to root_vol, set
mountpoint=None when using_subvolumes is True (matching
suggest_single_disk_layout()), and check LVM volumes in
has_default_btrfs_vols().
@Kolgrim33
Kolgrim33 requested a review from Torxed as a code owner October 25, 2026 17:18

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants