coreos / ignition

First boot installer and configuration tool
https://coreos.github.io/ignition/
Apache License 2.0
837 stars 247 forks source link

Support sfdisk backend for partitioning #1926

Open jlebon opened 2 months ago

jlebon commented 2 months ago

sfdisk is part of util-linux and has supported GPT partitioning for a while now. It'd be desirable to support using sfdisk instead of sgdisk for partitioning for OSes that want to shed that dependency.

Proposal:

  1. add a new sfdisk package that implements the same API as the sgdisk one
  2. support a compile option to change the default backend to use from sgdisk to sfdisk
  3. support a kernel argument option (e.g. ignition.partition-backend=(sfdisk|sgdisk)) to override compile-time defaults
  4. once we have some confidence in the code, change the upstream default to sfdisk and declare the sgdisk backend deprecated
  5. after a reasonable window, drop support for the sgdisk backend

On the FCOS side, we can start using the sfdisk backend in some of the non-production streams to get some early testing, and if deemed necessary, bake it in the next stream as well.

jlebon commented 2 months ago

cc @tormath1 @pothos for thoughts on this from the Flatcar Linux side.

pothos commented 2 months ago

With sfdisk we can skip running partx here: https://github.com/coreos/ignition/blob/3b3a27b64541d01b7bb18f5f923ca3a13dcea98e/internal/exec/stages/disks/partitions.go#L545 (And later delete it when only sfdisk woud be supported)

travier commented 2 months ago

We'll have to update things downstream as well. Filed: https://github.com/coreos/fedora-coreos-tracker/issues/1787

travier commented 2 months ago

Found some examples on how to pass commands to sfdisks: