This is a series of commits which adds a feature needed by GNOME OS' installer. This was show during All Systems Go 2025 talk: https://cfp.all-systems-go.io/all-systems-go-2025/talk/QRJVL3/ To sum up this PR, this changes first systemd-repart to use BLKPG partition instead of loop devices when possible. We need then to always rescan the partitions to try remove partitions if it failed. We allow encrypted partitions to stay activated and with a chosen name. And we add a new partition configuration `BtrfsReplace=`. Note that "replace" comes from the command `btrfs replace`. But in the case of systemd-repart, maybe "inplace" or "move" would make more sense. I open to suggestions. If it is better I can split this into several PRs. The commits: ## repart: Reuse the backing fd for fdisk Because fdisk_assign_device tries to open block devices with O_EXCL, when it does it blocks cryptsetup from using partition block devices for the same disk. Since we already have a file descriptor for the device, we can just share it and use fdisk_assign_device_by_fd instead. ## repart: Use blkpg partitions instead of loop devices when possible We will want to allow future features to keep some devices mounted or active. So in order to avoid leaving a mess of many loop devices, we can just already use the partition block device already. ## repart: Rescan disk on failure if we create blkpg partitions on the fly Since we did not write the partition table, then the created partitions should get removed on error. ## repart: Allow keeping luks2 volumes opened ## repart: Add BtrfsReplace= BtrfsReplace=/mntpnt will move the btrfs filesystem from mount point to the partition created. After moving, it will resize to take the whole partition. This is useful for OS installers that move a live system into a disk and do not require a reboot. ## repart: Add VolumeName= When a luks2 device mapper is to be kept alive after execution of systemd-cryptsetup, the name of the volume will be taken from this value. ## test: Add test for repart's BtrfsReplace
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
