Today I was trying to write a script for partitioning disks using fdisk (since that seemed like the simplest option).
When going through fdisk the first time and pressing n
for new partition, the first prompt asked if I wanted to make a primary or extended partition. I q
quit. On going back through the same procedure, the first prompt was for what sector I wanted to be first. Since I did not w
write any changes, nothing should have changed, right?
If I can't predict when fdisk will give me what prompts, then I can't reliably script it. Most stuff I read recommended sfdisk for scripting, but noted that SUN disk labels are not supported. Since I want to install ZFS on root, my understanding that won't work.
So how do I predict the prompts from fdisk, or what is an alternative for scripted partitioning that supports both UEFI and ZFS?
Note: I am comfortable scripting this because I have the /dev/disk/by-id/
of each device, so as not to be confounded by changing disk labels or UUIDs.
parted
supports UEFI, but dunno about ZFS. In any case, wouldn't it be better to use ZFS tools directly once you have created the partition? IMHOparted
also makes for better scripting. – muru Jun 27 '19 at 17:53