[parted-devel] [PATCH 1/2] libparted: check PMBR before GPT partition table (#805272)
Phillip Susi
psusi at ubuntu.com
Thu Mar 22 14:05:12 UTC 2012
On 3/21/2012 10:00 PM, John Gilmore wrote:
>> I don't think this patch is quite right. The exception should be fixed rather than removed. If it is supposed to be a GPT disk, then we should fix the broken PMBR. If it is not, then we should zap the GPT and then fail to recognize the disk as GPT ( thus allowing it to be recognized as DOS ).
>
> At startup, Parted should not be "zapping" anybody's disk drive, no
> matter how invalid it looks. The drive should remain read-only until
> if-and-when the user explicitly commands parted to write something.
>
> Occasionally, in the distant past, I have had to write zeroes over the
> first blocks of a disk (using "dd") in order to get parted to let me
> relabel it without getting confused by its prior contents. Perhaps
> parted should have a "zap" command that allows some area(s) of the
> drive to be zeroed without using a separate program. Then Parted could
> produce a diagnostic message when it detects this kind of mangled GPT,
> suggesting that the *user* "zap" the drive.
That's exactly what I'm talking about. The exception was already in
place to ask the user whether it is supposed to be gpt or not. The
missing part was the corrective action based on their response. If it's
supposed to be gpt, then fix the pmbr, if not, then zap the invalid gpt,
and of course, do neither if unhandled. Actually, I suppose it could be
broken into two parts: the yes/no to recognize it as gpt or not, and
then a second exception asking to ignore or fix the error. That way you
could choose to look at the disk one way, and then the other to help
decide which is the correct table before taking corrective action.
More information about the parted-devel
mailing list