[parted-devel] Interface to set partition type

Jim Meyering jim at meyering.net
Sun Nov 8 15:42:47 UTC 2009


Robert Millan wrote:
> On Mon, Oct 19, 2009 at 02:56:08PM +0200, Jim Meyering wrote:
>> In the longer term, we'll probably deprecate
>> it and instead add an interface to set a partition's type independent
>> of mkpart's "type" argument.
>
> I'd like to work on adding that interface.  I propose:
>
>   # GPT
>   $ parted /dev/sda type 1 00000000-0000-0000-0000-000000000000
>
>   # MSDOS
>   $ parted /dev/sda type 1 00
>
> Is that appropiate?

Thanks for volunteering.

Good timing.
Just two or three days ago, Rich Jones was asking
about setting the partition type to arbitrary values,
though I think he found a reasonable work-around.

"type" sounds a little too generic.  But it does have an advantage...
One alternative is "part-type".
If we go with that (it'd be the second command name starting with "p"),
we may have to be careful to continue to support "p" as an abbreviation
for "print".

If you do implement this, please use gnulib's xstrtoul to convert
an msdos type string so that inputs may be hexadecimal, octal or decimal.

I see you have a copyright on file for parted.  Good.

Regarding format, please follow the guidelines in
  http://git.sv.gnu.org/cgit/coreutils.git/plain/HACKING

A complete change like this will also update NEWS, documentation and tests.
Re tests, if you merely outline the commands you'd run to get
reasonable coverage of the new code, I'll write the actual
test script.



More information about the parted-devel mailing list