Hi Pascal, On Sat, Jul 12, 2025 at 11:38:20AM +0200, Pascal Hambourg wrote: > Debian installer's partitioning tool, partman, is based on libparted. By > default, it applies parted's "optimal" alignment constraint. On disks with > 512-byte sector size, it aligns partition start and end positions on 1-MiB > (2048 sectors) boundaries. Additionally, it reserves a gap at the end of the > disk to avoid ambiguity about whether MD RAID 0.90 or 1.0 metadata belong to > either the entire disk or the last partition.
Thanks for the detailed explanation! I'm still a little confused why partman alters supplied sizes that come from something that was previously installed by partman. I was giving it sizes that were 1-MiB aligned so I expected the first one to start 2048 sectors from the start and go on for the exact amount of bytes specified, since those values were already aligned. > The partitioning log is recorded in /var/log/partman during the installation > or in /var/log/installer/partman in the installed system. Is there any way to use this log to feed in to another instance of partman to replicate what was done before? Or can it just be used to make a preseed that would exactly replicate it? Reading all you've given here, I now kind of understand what it does and why, but it still doesn't sound possible to easily replicate what was already done in another partman. > It is important to note that reported free space intervals do not take the > alignment constraint into account, so the resulting partition size may be at > worst 2-MiB smaller than the desired size. This is blatant with the first > partition at the beginning of the disk: the reported free space begins right > after the partition table (at sector 2 with MSDOS, 34 with GPT), so partman > will request to create a partition in interval 34-(34+desired size), then > will align the start sector to 2048. This results in a partition being 1-MiB > smaller than expected. > > The free space after the first partition is aligned, so the next primary > partition sizes should not be altered if they are multiple of 1 MiB. On > MSDOS, logical partition size is reduced by 1 MiB because of the nested > extended partition table before each logical partition. I did notice that the first partition I asked for by exact byte count ended up 1 MiB smaller than I expected so I was able to replicate what I wanted by asking for an extra 1MiB, however then I saw this didn't hold true for the next partition. Perhaps if I had done the adjustment for the first partition but then not for any others I would have been able to do it? i.e. given existing partman-installed system: $ head -6 /proc/partitions major minor #blocks name 8 16 1875374424 sdb 8 17 487424 sdb1 8 18 976896 sdb2 8 19 1952768 sdb3 I could ask for exact sizes: $ echo "487424*512 + 1024" | bc 249562112 $ echo "976896*512" | bc 500170752 $ echo "1952768*512" | bc 999817216 Anyway, I will look into preseed as I should probably do things that way if I want them to be replicated. Thanks, Andy

