0

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?

Paul D Smith
  • 639
  • 5
  • 16
  • BTW, fdisk allows 'immediately after' if you pipe responses to it's prompts. Fdisk prompts with a start of 'the value of the first sector after the last partition' and you can simply hit to accept this - and then specify the size. – Paul D Smith Feb 14 '18 at 10:15
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Feb 14 '18 at 10:44

0 Answers0