[parted-devel] [PATCH] Do not discard bootcode from extended partition

Bryn M. Reeves bmr at redhat.com
Fri Jan 23 14:31:01 UTC 2009


James Courtier-Dutton wrote:
> I thought that valid boot sectors have a checksum or some kind of
> signature bytes. It might be worth verifying that it is a valid boot
> sector before blindly using it. If it is not a valid boot sector, one
> might as well fill it with zeros.

Which field are you thinking of here? There's the (optional) 32-bit 
disk signature at 0x01b8 (immediately following the executable code) 
and the 16-bit MBR signature at 0x01fe.

 From what I can see, neither of these would be suitable.

The disk signature is optional and is only intended to be a unique 
identifier. The "MBR signature" is intended to signify a valid MBR but 
it's not based on any kind of checksum - if the field contains 
"0xaa55" it's valid, any other value and it's not.

I just checked a bunch of devices that have valid MSDOS partition 
tables but do not have valid boot code (removable USB devices, some 
auxiliary HDs and a bunch of LUNs on my iscsi test box). All of these 
had the 0xaa55 signature, but no valid bootcode at offset 0, so I 
don't think we can use this as a check.

Regards,
Bryn.




More information about the parted-devel mailing list