[parted-devel] [patch] Use 'p' partition separator only when necessary
Phillip Susi
psusi at cfl.rr.com
Fri Mar 11 22:12:06 UTC 2011
On 3/11/2011 4:04 PM, Jim Meyering wrote:
> Thanks for the patch.
>
> This sounds like a good change.
> However, can you give a little more detail?
> Does parted's current behavior induce failure in some other tool?
> What's the motivation?
>
> And especially, can you write a test for it, or at least
> outline a quick procedure for demonstrating how this changes
> parted's behavior (in which case I'll write it)?
It seems that the behavior was copied from dmraid, which decided a while
back to start adding the 'p' always. Debian and Ubuntu have been
carrying a patch to reverse that change to both dmraid and parted.
Initially I got that patch dropped in Ubuntu during the Natty
development cycle because we want to avoid diverging from upstream, and
if the base device name ends in a digit, then you NEED the 'p' or
various tools get confused about what is the disk name and what is the
partition name.
This then lead me to gparted causing a problem. It had code to handle
dmraid devices specially from before libparted could, and it was
invoking dmraid to create the partition devices, and explicitly telling
it not to add the 'p'. This meant that a duplicate partition device was
created, without the 'p' in the name ( /dev/mapper/RAID1 and
/dev/mapper/RAIDp1 ). Having two devices for the same partition is very
bad. You can end up doing things like delete the partition while it is
mounted and reuse its space in another partition, because the checks to
see if the partition are mounted do not know about the duplicate device.
After speaking with the gparted maintainer, he has provided a configure
switch to disable the gparted dmraid handling code and leave it up to
libparted, which solves the duplicate device problem. During that
discussion I also learned that the kpartx tool which some distributions
use to create the partition devices instead of dmraid only adds the 'p'
if the previous character is a digit. Further discussion on mailing
lists indicated that this is the correct behavior that Linux has used
"since the dawn of time".
As a result, I have made patches to both parted and dmraid ( and sent
the one for dmraid to its mailing list ) to make the 'p' only when the
previous char is a digit. If parted and whatever other component
normally creates the partition devices ( dmraid or kpartx ) disagree on
the name, then you can end up with duplicate devices, so I am trying to
get everyone using the same name.
More information about the parted-devel
mailing list