svn commit: r221972 - head/sys/geom/part

Andrey V. Elsukov ae at FreeBSD.org
Mon May 23 06:29:36 UTC 2011


On 23.05.2011 6:29, Warner Losh wrote:
> Looking at one of my flash drives that shows the problem:
> 
> da0: 15423MB (31588351 512 byte sectors: 255H 63S/T 1966C) GEOM_PART: partition 1 has end offset
> beyond last LBA: 31588350 > 31588325
> 
> So why does gpart think the last LBA is 25 less than it really is.  Well, let's do some sanity
> checks first.  fdisk -s da0 tells us:

> I'm pretty sure this problem is due to a bug in g_part_mbr.c:
> 
> basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
> 
> This is wrong, or at least it is a widely disregarded part of what makes up an MBR.  When I
> correct the size, the geom code is fine.  There's no requirement in MBR that a partition end of
> any particular boundary, although sometimes you'll find mistaken documentation that suggests this
> is the case.  Reading between the lines at http://www.boot-us.com/gloss03.htm suggests that this
> restriction was only for disks < 8GB in size (from the fact it said that all the partitions can
> be described with the CHS fields).  This is one of the things I learned when I tried to make
> fdisk enforce that: this isn't a requirement of MBR as it is implemented in the wild today.

There is another opinion:
http://www.boot-us.com/gloss02.htm

"There is the convention that partitions should always start and end on *cylinder boundaries*."

but

"Linux and Windows NT/2000/XP/2003/Vista/2008/7 seem to have no problems when partitions do not
start or end on cylinder boundaries. However other operating systems (e.g. DOS) expect that this
convention is obeyed."

What way will we choose?

I prefer to: leave the choice to the user how partition should be aligned, and remove automatic
alignment to track boundaries from MBR (and probably from all other schemes).

-- 
WBR, Andrey V. Elsukov

-- 
WBR, Andrey V. Elsukov

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20110523/ef53bd53/signature.pgp


More information about the svn-src-all mailing list