[parted-devel] Interface to set partition type

Jim Meyering jim at meyering.net
Wed Nov 11 09:09:37 UTC 2009


Håkon Løvdal wrote:

> 2009/11/9 Karel Zak <kzak at redhat.com>:
>> On Mon, Nov 09, 2009 at 11:17:58AM +0100, Jim Meyering wrote:
>>> It seems like it'd be useful to be able to extract existing types,
>>> too, so how about making the string argument optional.
>>> Then, this would print the type of the first partition:
>>>
>>>     $ parted /dev/sda part-type 1
>>
>>  This reminds me ...
>>
>>  ... it would be also nice to have a way how set partition UUID.
>>  Currently GPT UUID is always generated. Maybe we will use the UUID
>>  for some userspace operations (DevKits, udev, mount, ...) and then
>>  people will look for a way how to control this identifier.
>>
>>  (Yes, I know that UUID should be unique, but sometimes is it very
>>  useful to create a new disk layout with the same UUIDs.)
>>
>>     $ parted /dev/sda part-uuid 89ec2a20-ab3a-4105-b5e8-b141666fbd0c
>>
>>  ?
>
>>From an interface point of view, such optional arguments which completely
> changes the meaning of the corresponding command (i.e. part-uuid without
> an argument means GET uuid, with an argument it means SET uuid)
> should preferably be avoided.

Valid point, since the parted command-line UI has no way to
separate multiple commands in a single command-line invocation.

An alternative is to let some special token, say "-", or even "print"
indicate that rather than setting the type, we want to print it.
While perhaps not aesthetic from a usability standpoint, it would
be less invasive (and that's important with parted, now) than
adding set- and print- commands.

Thanks for the feedback.

> It is much better to have distinct commands for each operation.
> Think about when combining several commands on the command line,
> for instance
>
>      $ parted /dev/sda part-uuid part-type 1
>
> Does this mean to try to set the UUID to "part-type"? Compare to
>
>      $ parted /dev/sda set-type 1 00
>      $ parted /dev/sda set-part-uuid 89ec2a20-ab3a-4105-b5e8-b141666fbd0c
>      $ parted /dev/sda print-type 1
>      $ parted /dev/sda print-part-uuid
>
> where each command is clear and simple to understand. The "set-" prefix
> does probably not add so much value, but I would strongly prefer to
> add "print-" to all the get commands and make them distinct from the set
> commands.



More information about the parted-devel mailing list