[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

debian-installer: how to exactly specify partition sizes?



Hi,

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".

Thanks,
Andy


Reply to: