Richard W.M. Jones wrote: > 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).
Hi Rich, It appears (I wasn't involved) that the program we know as "parted" was originally intended solely as a convenient way to exercise the functionality provided by libparted. I would welcome a new command-line tool with a better interface and additional functionality. Alternatively, we could add to the existing command-line interface. In particular, "mkpart" (your #3) would need a replacement, say "make-partition". I haven't looked at the code, but suspect it could be arranged to print some indication of the resulting partition number for each one it creates. I think someone was working on an interface to get/set aspects of a partition and/or partition table. For #5, provide a new sub-command, or a new option to "print". I agree wholeheartedly that using parted's command-line interface is no fun. However, most of the issues you raise can be addressed without sacrificing compatibility. It's just a SMOP ;-) _______________________________________________ parted-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/parted-devel

