[parted-devel] Interface to set partition type

Jim Meyering jim at meyering.net
Sun Nov 8 16:15:28 UTC 2009


Robert Millan wrote:
> On Sun, Nov 08, 2009 at 04:42:47PM +0100, Jim Meyering wrote:
>> 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".
>
> I thought about part-type, but then it came to mind: Parted is a partition
> tool; shouldn't it be implicit that we're setting the type of a partition?

There's also the type of the partition table itself.
With "mkpart" already using "part" to refer to "partition",
I figured that "part-type" would usually be interpreted the right way.

>> 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.
>
> Alright.  I won't have time to do this today, but expect me to come back
> with code sometime around next week.

Good!  If it's not too late in the week, it might make the
cut for the upcoming parted-2.1



More information about the parted-devel mailing list