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

how to get predictible partition sizes with partman ?



Hi,

I try to automatically format the disk during Debian installation with
a "recipe" for partman in preseed.cfg.

I have some difficulties to get partitions the size i want. First of
all, partitions must have a size multiple of 1MiB (1MiB = 2^20 Bytes)
but partman reads sizes in preseed.cfg as expressed in MB (1MB = 10^6
Bytes). As it is not possible to express exactly a multiple of 1 MiB
in MB, partman will have to find the nearest multiple of 1MiB.

I specified the following dummy recipe in preseed.cfg:
d-i partman-auto/expert_recipe string \
20973 100000 20973 ext3 $primary{ } method{ format } format{ }
use_filesystem{ } filesystem{ ext3 }  mountpoint{ / } . \
106 100000   106 ext3 $primary{ } $bootable{ } method{ format }
format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ /boot } . \
20973 100000 20973 ext3 $primary{ } method{ format } format{ }
use_filesystem{ } filesystem{ ext3 }  mountpoint{ /home  } . \
20973 10000 20973 ext3 method{ format } format{ } use_filesystem{ }
filesystem{ ext3 } mountpoint{ /var } . \
2099 10000  2099 linux-swap method{ swap } format{ } . \
2099 10000 2099 ext3 method{ format } format{ } use_filesystem{ }
filesystem{ ext3 } mountpoint{ /tmp } . \
20973 10000 20973 ext3 method{ format } format{ } use_filesystem{ }
filesystem{ ext3 } mountpoint{ /opt } . \
106 10000 106 ext3 method{ format } format{ } use_filesystem{ }
filesystem{ ext3 } mountpoint{ /foo } . \
0 100   -1 ext3  $primary{ } method{ format } format{ }
use_filesystem{ } filesystem{ ext3 } mountpoint{ /usr } . \

I wanted the first partition to be 20000 MiB, so, in MB: 20000 * 2^20
/ 10^6 = 20971. After experimentations i saw that i need to add "2" to
get my 20000MiB. So that was for the "20973". I computed the other
sizes the same way.
Unfortunately, i still don't get predictibles partition size:

# fdisk -u -l
Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders, total 524288000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00033693

     Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    40962047    20480000   83  Linux
/dev/sda2   *    40962048    41168895      103424   83  Linux
/dev/sda3        41168896    82130943    20481024   83  Linux
/dev/sda4        82132990   524285951   221076481    5  Extended
/dev/sda5        82132992   123092991    20480000   83  Linux
/dev/sda6       123095040   127193087     2049024   82  Linux swap / Solaris
/dev/sda7       127195136   131293183     2049024   83  Linux
/dev/sda8       131295232   172255231    20480000   83  Linux
/dev/sda9       172257280   172462079      102400   83  Linux
/dev/sda10      172464128   524285951   175910912   83  Linux

Problem: /dev/sda1 and /dev/sda3 have different sizes, although i
asked the same size in preseed.cfg (20973). Same problem for /dev/sda2
and /dev/sda9 (106).

After a bit of debug, i saw that partman is not the problem here. As
max_size and min_size are equals in the recipe, he cannot do anything
nasty. Indeed, partman sends correct sizes to parted_server, but
parted_server does not behaves identically for two NEW_PARTITION
command with the same size...

Finally my questions are:
1) Is there a way to know what we should write in the recipe to get
partitions the size we want ? (I mean, without testing and rewriting
until it works..).
2) Do you know why parted_server makes partitions of different size
even if we ask for the same size ? Is it predictible ?

Thanks


Reply to: