[OE-core] "parted" vs "sfdisk"

Andrew Bradford andrew at bradfordembedded.com
Fri Aug 5 13:00:18 UTC 2016


Hi Robert,

On 08/05 06:19, Robert P. J. Day wrote:
> 
>   your personal opinions, if you would -- i'm working on some scripts
> to do automated installs on a target board, currently based on
> parted, but parted seems a bit dense at times, and awkward, and i'm
> thinking of switching to sfdisk.
> 
>   for people who have done this sort of thing, do you have any strong
> opinions either way of parted versus sfdisk? i realize that's not much
> to go on, just curious about personal preferences, and why.

sfdisk has changed both its input format and command-line options in
recent versions of util-linux.  If you're scripting sfdisk, you need to
be aware of this as some of the people who use your scripts will have
varying versions of util-linux.  For example, in my experience,
util-linux 2.28 in Debian Stretch and util-linux 2.25.2 in Debian Jessie
cannot have their sfdisk executables scripted in the same way and then
produce the same set of partitions when setting up an SD card for an
embedded system.

The change in input format and command-line options happened around
util-linux 2.26-2.27 but I haven't dug into it too much to find out
exactly when.

The newer input format for sfdisk is quite nice, imho, and easy to read.
You can do something like this now:

{
echo "label: dos"
echo "start=1MiB size=32MiB type=0x0C bootable"
echo "start=33MiB"
} | sfdisk ${DEVICE}

While the older sfdisk input format would look something like:

{
echo 1,32,0x0C,*
echo 33,,,-
} | sfdisk ${DEVICE}

Thanks,
Andrew



More information about the Openembedded-core mailing list