[parted-devel] A short rant about parted

Richard W.M. Jones rjones at redhat.com
Sat Apr 10 08:10:01 UTC 2010


As you may not know, we have written a library for virtual machine
disk manipulation called libguestfs (http://libguestfs.org/).  Part of
this library allows you to manipulate the partition table.  For this
we use parted.  However parted is very annoying to use in practice.

(1) You can't get and set individual aspects of a partition.  For
example: You can set the bootable flag, but getting it involves using
'parted print' to get the entire table and parsing the whole output.

(2) You can't get and set the MSDOS type byte or the GPT label at all.
Although real operating systems don't care about the type byte, it is
*essential* for making Windows bootable.

(3) The mkpart command is ill-defined.

  mkpart [PART-TYPE FS-TYPE NAME] START END

but this depends on the partition type.  eg. If you do:

  mkpart primary 10 20

then this makes a primary partition if the partition table is MBR, but
it makes a partition called "primary" if the partition table is GPT.

(4) You can add a partition, which (AFAIK) adds it in the first
available slot.  You don't know which slot was used except by a very
complex process of parsing 'parted print'.  And as mentioned in point
(1) almost any update operation (except for the boot flag) involves a
complex process of parsing 'parted print'.

(5) Machine-readable format is not very machine-readable.

(6) The library part of parted is complex and ill-documented, and
doesn't solve any of the above.  You still can't set the type byte
even at the library level.

Honestly I'm sick of parted and I'd rather have a small library that
can just do MBR and GPT partition tables (those are the only ones that
anyone cares about).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v



More information about the parted-devel mailing list