Using parted to create a partition xGB after the last one?

233 Views Asked by At

I've inherited some code that pipes a list of 'random' characters to fdisk. What it is doing is partitioning a disk essentially 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.

This code is extremely opaque and I would like to replace it with 'parted --script...' instead of fdisk but I can't see that parted has a way to say 'start immediately after the last partition'.

Am I correct and if so does anyone have a sensible solution for this?

0

There are 0 best solutions below