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

Bug#353257: partman-auto always creates an extended partition



Package: partman-auto
Version: 41

I'm using partman-auto to create 3 primary partitions automatically, using a preseeded partman-auto recipe.
(I'm using debian-31r0a-i386-netinst.iso as a basis)

This is the recipe I use:

boot-root :: 
    2048 2048  200%       linux-swap $primary{ }              method{ swap }   format{ } .  
    64   64    64         ext3       $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ /boot } .  
    500  10000 1000000000 ext3       $primary{ }              method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / } .

When this actually succeeds (see my other bugreport on free diskspace checking shortly), partman-auto will create 3 partitions: 2 primary and 1 extended with 1 logical inside.

I have tracked the bug to the following code in perform_recipe (line 120):

    if
        [ -z "$neighbour" -o "$fs" != free \
          -o "$new_free_type" = primary -o "$new_free_type" = unusable ]
    then

The while loop this code is in is resposible for creating the primary partitions.
For every primary partition, it creates the partition. After that comes this check.
The purpose of this if statement is to make sure some more usable free space exists.
If there is not enough space, partman-auto removes the last partition and creates a new extended partition.

In my case, where 3 primary partitions make up the entire disk, partman-auto will create the 3rd partition,
then notice no more space is left, remove the 3rd partition and create an extended and logical one.

I added this around the entire if statement:

    # if scheme only contains 1 partition (the one we just created), then there is no need to check for more room
    steven_partitions_to_go=$((`echo $scheme | wc -l` + 0));
  

    if [ $steven_partitions_to_go -gt 1 ]; then

    ... old line 120 to line 145 goes here ...

    fi

What this does is store the amount of partitions left in $scheme, in $steven_partitions_to_go. 
If that is 1 or less, then skip the if statement because no more diskspace will be required.

I've tested this with my preseeded installation and it works.
I haven't checked for any other recipes.

More information and a combined patch (for this and other bugs) can be found on my blog at http://www.singularity.be/node/6159 
(also the previous posts about automated installations)

greets,
-- Steven



Reply to: