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

partman auto partitioning recipes



Hi

I could do with some help in relation to the configuration of the
partman disk recipes.  Call me stupid (no hang on please don't) but I'm
having difficulty working this out.

I've got it working by throwing in some figures until I've got what I
wanted.  But I'm trying to work this out logically so that I can be sure
that it works for all the different types of hardware I have here.

I want to configure the partition table as follows:

Partition label		Size			Type
---------------		----
/			8gb			Primary
swap			2 * RAM			Primary
/var			rest of disk		Primary

This assumes that we've already told DI to install on the first
IDE/SATA/SCSI disk it finds.

I've achieved this with the following recipe:

===--------------------------------------------===

partition_scheme ::

256 2000 210% linux-swap
        method{ swap }
        format{ }
        .
500 2000 8500 ext3
        $primary{ }
        $bootable{ }
        method{ format }
        format{ }
        use_filesystem{ }
        filesystem{ ext3 }
        mountpoint{ / }
        .
100 500 100000000 ext3
        $primary{ }
        method{ format }
        format{ }         use_filesystem{ }
        filesystem{ ext3 }
        mountpoint{ /var }
        .

===--------------------------------------------===

Number 1.

It does not seem possible to set all partitions to be primary.  One of
the partitions has to be extended.  Why?  Am I doing something wrong
here?

Number 2.

To ensure that the root partition is created as 8192Mb, I have to set it
to 8500Mb or so.

Number 3.

I've tried working out the outcome of the partition sizes using the
equation provided on the README page (partman-auto-recipe.txt) with no
success.  Does anyone have a handy little perl script already thrown
together to work this out?

===--------------------------------------------===

HOW THE ACTUAL PARTIITON SIZES ARE COMPUTED
-------------------------------------------

Suppose we have to create N partitions and min[i], max[i] and
priority[i] are the minimal size, the maximal size and the priority of
the partition #i as described in section 1.

Let free_space be the size of the free space to partition.

Then do the following:

for(i=1;i<=N;i++) {
   factor[i] = priority[i] - min[i];
}
ready = FALSE;
while (! ready) {
   minsum = min[1] + min[2] + ... + min[N];
   factsum = factor[1] + factor[2] + ... + factor[N];
   ready = TRUE;
   for(i=1;i<=N;i++) {
      x = min[i] + (free_space - minsum) * factor[i] / factsum;
      if (x > max[i])
         x = max[i];
      if (x != min[i]) {
         ready = FALSE;
         min[i] = x;
      }
   }
}

Then min[i] will be the size of partition #i.

===--------------------------------------------===


If you've read this and responded with some help - Many thanks.

kind regards

- William



Reply to: