This is a little bit confusing, but grain size is not actually stored in the gpt metadata. Rather, fdisk's `get_grain_size()` returns an autodiscovered "optimal io size" value as grain size. This might not actually be the grain size that the disk we're copying is using. Since we're setting the padding of the copied partitions using that value from fdisk, we're rounding the new paddings by fdisk's optimal grain size, which is usually 1MiB (a lot more then the default 4KiB that we're using otherwise). Set the grain size here to 1 byte instead, ensuring that the min/max padding set is exactly the padding that was present before. Also add a test to confirm the behavior is fixed: The test calls --copy-from= on an existing disk with 4MiB grain size, and because we pass --grain-size=512, now no rounding should happen and the paddings should be transferred to exactly the same size.
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
