Skip to content

Conversation

@schaefi
Copy link
Collaborator

@schaefi schaefi commented Jul 9, 2025

So far the check for unallocated space was only working for GPT and there it was also not really stable. The check was based on verifying if the backup GPT table is really at the end of the disk. Depending on which tool was used to dump the image on the target this "mistake" often got corrected by the tools that dumped the image. In this case the check no longer worked. This commit improves the check by another test which looks for the real free bytes on disk compared to the current partition geometry.

@schaefi schaefi requested a review from davidcassany July 9, 2025 13:32
@schaefi schaefi self-assigned this Jul 9, 2025
So far the check for unallocated space was only working for GPT
and there it was also not really stable. The check was based on
verifying if the backup GPT table is really at the end of the
disk. Depending on which tool was used to dump the image on the
target this "mistake" often got corrected by the tools that
dumped the image. In this case the check no longer worked.
This commit improves the check by another test which looks
for the real free bytes on disk compared to the current
partition geometry.
@schaefi schaefi force-pushed the fix_disk_has_unallocated_space_check branch from 8157098 to b40829d Compare July 9, 2025 13:39
@schaefi schaefi requested a review from Conan-Kudo July 9, 2025 13:39
@Conan-Kudo Conan-Kudo enabled auto-merge July 9, 2025 13:41
@Conan-Kudo Conan-Kudo merged commit a53c495 into main Jul 9, 2025
14 checks passed
@Conan-Kudo Conan-Kudo deleted the fix_disk_has_unallocated_space_check branch July 9, 2025 13:43
# to detect a geometry change for non GPT based disks.
# Thus we assume it's not fully allocated and allow
# for resize
if sfdisk --list-free "${disk_device}" 2>&1 | grep -q "${flag}"; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reposting here in case you didn't see my comment in the forum. I don't think this will behave as you expect, since this warning does not disappear after successful resize by kiwi-repart.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uecasm I also think I did not well thought through all cases. In my test that resizes to the full capacity, sfdisk did no longer show any warning and just displayed

Unpartitioned space /dev/sda: 0 B, 0 bytes, 0 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

But I found other issues and more changes will be needed

schaefi added a commit that referenced this pull request Jul 17, 2025
The partition id metadata file is used in the kiwi-repart
module. If a user wants to use the kiwi repart module
permanently, this metadata file needs to stay in the system.
Therefore it should not be automatically deleted by the
cleanup. A disk.sh hook script can be used to force the
deletion of the file though. This is related #2851
schaefi added a commit that referenced this pull request Jul 17, 2025
Using sfdisk for relocation and verification makes this
part more consistent. We also want to move away from gdisk.
This is related to #2851
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.

4 participants