go-debos / debos

Debian OS builder
Apache License 2.0
533 stars 136 forks source link

action image-partition: Failed to create msdos extended partition table #480

Open piotr-maker opened 7 months ago

piotr-maker commented 7 months ago

If i try to create more than 4 partitions in msdos partition table i've got error:

2024/02/08 07:54:37 parted | Error: You requested a partition from 8912MB to 9226MB (sectors 17405952..18020351).
2024/02/08 07:54:37 parted | The closest location we can manage is 8912MB to 9226MB (sectors 17405953..18020351).

The error occures, because debos don't leave space for EBR (1 sector). In file: actions/image_partition_action.go in function Verify() the start of extended partition is assigned to same value as next partition:

if idx == 3 && len(i.Partitions) > 4 {
    var name string
    var part Partition

    name = "extended"
    part.number = idx + 1
    part.Name = name
    part.Start = p.Start
    tmp_n := len(i.Partitions) - 1
    tmp := &i.Partitions[tmp_n]
    part.End = tmp.End
    part.FS = "none"

    i.Partitions = append(i.Partitions[:idx+1], i.Partitions[idx:]...)
    i.Partitions[idx] = part

    num := 1
    for idx, _ := range i.Partitions {
        p := &i.Partitions[idx]
        p.number = num
        num++
    }
}