I’ve inherited a shell script that pipes a list of ‘random’ characters to fdisk
. What it is doing is partitioning a disk as follows:
Set up the blank disk, partition table etc
Create first partition size A
Create second partition, size Y, immediately after the first one.
Create third partition, size X, immediately after the second one.
And to add to the ‘fun’, A, Y, and X are calculated and may change depending on the size of the available new disk.
Fdisk will prompt for starting position based on the existing positions and the ‘code’ just ‘hits return’ and accepts this.
This code is extremely opaque and I would like to replace it with calls to ‘parted --script...
‘ instead of fdisk
but I can’t see that parted has a way to say ‘start immediately after the last partition’. It looks like I would have to keep calculating the start position myself.
Am I correct and if so does anyone have a sensible solution for this?