Comment 20 for bug 945433

Revision history for this message
Rod Smith (rodsmith) wrote :

Psusi wrote: "This points to gdisk comparing the disk size to the MBR size, rather than the GPT size."

I assure you that this is **NOT** the case! The code that computes the disk size does **NOT** refer to MBR data structures. GPT fdisk works fine on over-2TiB disks, for which MBR data structures are necessarily much smaller than the disk's actual size. It also works fine with hybrid MBRs, which have 0xEE partitions in the MBR that are generally much smaller than the disk's size, and additional partitions that may or may not pad out the length. You're seeing a correlation and inferring causation -- always a risky endeavor!

Ahmad Moawya wrote: "I verified my disk using GPT fdisk (gdisk) and verification was successful (found valid GPT and protective MBR)"

When I first read this statement, I assumed you meant that you used the gdisk verify ("v" from any menu) function, but it occurs to me that you might have meant that you launched gdisk and saw the "partition table scan" results that said the GPT was valid. If so, please run gdisk again and do a "v" on the disk. Also, check the gdisk output when you type "p" to see what it reports as the disk's size in sectors. My suspicion is that gdisk will report a disk size of 312579695 sectors and, when you do a "v", it will report errors relating to the disk being too small for the partitions it contains. If so, then it would appear that the HPA feature is carving out part of the disk, as psusi suggests, and that all your current tools are using this HPA-reduced size, but that the disk was originally prepared with software (a Linux or other OS kernel) that didn't respect the HPA, or with HPA settings set at some other value. With the HPA now active, the fdisk output is largely irrelevant but partially diagnostic, OS X's Disk Utility isn't reporting an error because it's fairly lax about reporting errors in the placement of the backup data, parted is throwing up its hands as it usually does with damaged disks, and gdisk is reporting an error only when told to run a diagnostic (or it would report an error if you told it to save the partition table). That last is speculative, though; the gdisk data you've provided is limited.

I have limited experience with HPA, but according to Wikipedia (http://en.wikipedia.org/wiki/Host_protected_area), there are various tools you can use to manipulate it. You should research this more, but one possible fix would be to use one of those tools to disable HPA. Another fix would be to use the "e" option on gdisk's experts' menu to move the backup GPT data to where it belongs (given the HPA-reduced size) and then re-save the partition table. It should then be possible to use libparted-based tools on the disk.

Of course, even if I'm right about all this, that doesn't mean that libparted shouldn't handle such errors better.