Andy Smith composed on 2025-07-10 22:52 (UTC): > Let's say I have an existing machine that was installed using the text > mode trixie RC1 debian-installer, and I want to exactly copy the > partition layout of this machine on the next machine.
> Probably the best long term way would be to record the partitioning > details in a preseed file and load that. > But let's say I want to do it by hand. How? > The manual partitioner accepts B, MB, GB and the binary equivalents as > units. However, there is not any value I can specify that replicates an > existing disk layout. > For example, given this: > $ head -4 /proc/partitions > major minor #blocks name > 259 1 7501465944 nvme1n1 > 259 2 487424 nvme1n1p1 > You'd expect that specifying "499122176B" (that's 487424 * 1024) would > result in a partition of exactly 487424 1024-byte blocks being created, > right? Nope, it creates one 498073600 bytes long which is exactly 1 MiB > (1048576 bytes) less than what I asked for. > Also trying to use MB or MiB never does result in anything that exactly > matches the other existing partition layout. > I can make the first partition match by manually adding 1048576 bytes > and asking for that. But when I try the same trick with the next > partition, again it gives me something slightly off. > Why does it alter the value I specify? The other machine was installed > using debian-installer so if there is some alignment thing going on, > well, the original one was acceptable to debian-installer so it > shouldn't need to alter the values I specify. > Presumably I could replicate it by remembering the value I typed in when > installing the first one, since hopefully the changes it makes are > deterministic. But I don't remember. > Any ideas? Perhaps I can get sfdisk into the installer environment then > I could paste the output of sfdisk -d into sfdisk at a shell prompt. > It feels wrong that the installer doesn't give me n amount of bytes when > I ask for it with "nB". I can't help with what you actually asked for, because I never use any OS installer's partitioner to add, remove, resize, or anything else to do with partition table writes that isn't merely about UUIDs, LABELs or filesystem formats. I use OS installers for nothing more than formatting or naming, if required, or assigning existing partitions to mount points. All partitioning I do I have been doing the same way since last century, using text mode partitioner from http://www.dfsee.com/ that writes fully compatible tables whether run from its binaries for DOS, OS/2, Windows, Linux, or (as I hear it) MacOS (where I boot Linux to partition). Using DFSee gives me exactly what I desire on a consistent and reliable basis, and I get logs in the process whose selected sections serve as catalogs of what I have installed where on the hundred or more HDDs and SSD scattered about the premises. -- Evolution as taught in public schools is, like religion, based on faith, not based on science. Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! Felix Miata

