tinkerbell / actions

Suite of Tinkerbell Actions for use in Tinkerbell Workflows
Apache License 2.0
28 stars 43 forks source link

rootio partition command leaves huge blank spaces between partitions #98

Open SlavaValAl opened 1 year ago

SlavaValAl commented 1 year ago

rootio partition command leaves huge blank spaces between partitions

Expected Behaviour

rootio partition command do not leave huge blank spaces between partitions

Current Behaviour

rootio partition command leaves huge blank spaces between partitions

Possible Solution

Problem is there. It's enough to change: sectorStart += sectorEnd to: sectorStart = sectorEnd + 1

And result looks good: New Partition Name=EFI Start=2048 End=493568 New Partition Name=ROOT Start=493569 End=210208769 New Partition Name=HOME Start=210208770 End=315066370 New Partition Name=LOG Start=315066371 End=419923971 New Partition Name=DOCKER Start=419923972 End=1875382960

Steps to Reproduce (for bugs)

For example we have following disks configuration: { "metadata": { "instance": { "storage": { "disks": [ { "device": "/dev/sda", "partitions": [ { "label": "EFI", "number": 1, "size": 491520 }, { "label": "ROOT", "number": 2, "size": 209715200 }, { "label": "HOME", "number": 3, "size": 104857600 }, { "label": "LOG", "number": 4, "size": 104857600 }, { "label": "DOCKER", "number": 5, "size": 0 } ], "wipe_table": true } ], "filesystems": [ { "mount": { "create": { "Options": [ "-n", "EFI" ] }, "device": "/dev/sda1", "format": "vfat", "point": "/boot/efi" } }, { "mount": { "create": { "Options": [ "-L", "ROOT" ] }, "device": "/dev/sda2", "format": "ext4", "point": "/" } }, { "mount": { "create": { "Options": [ "-L", "HOME" ] }, "device": "/dev/sda3", "format": "ext4", "point": "/home" } }, { "mount": { "create": { "Options": [ "-L", "LOG" ] }, "device": "/dev/sda4", "format": "ext4", "point": "/var/log" } }, { "mount": { "create": { "Options": [ "-L", "DOCKER" ] }, "device": "/dev/sda5", "format": "ext4", "point": "/var/lib/docker" } } ] } } } }

As a result we get following partition list for disk size 894GB: New Partition Name=EFI Start=2048 End=493568 New Partition Name=ROOT Start=495616 End=210210816 New Partition Name=HOME Start=210706432 End=315564032 New Partition Name=LOG Start=526270464 End=631128064 New Partition Name=DOCKER Start=1157398528 End=1875382960 As you can there is a huge spaces between HOME-LOG-DOCKER partitions.

Your Environment

Debian Stretch