From owner-svn-src-head@FreeBSD.ORG Mon May 23 14:29:07 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF07D106564A; Mon, 23 May 2011 14:29:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 5959E8FC17; Mon, 23 May 2011 14:29:07 +0000 (UTC) Received: from 63.imp.bsdimp.com (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p4NEJHqs002156 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 23 May 2011 08:19:17 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <4DD9F0A3.701@FreeBSD.org> Date: Mon, 23 May 2011 08:19:16 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201105152003.p4FK3tnS050889@svn.freebsd.org> <20110522093302.GA2638@mole.fafoe.narf.at> <6AE10D76-AC2F-4D7B-A985-EE072949ECC4@xcllnt.net> <42C49AE5-C8EA-44A0-AF88-16130BACE912@bsdimp.com> <4DD9F0A3.701@FreeBSD.org> To: "Andrey V. Elsukov" X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Mon, 23 May 2011 08:19:17 -0600 (MDT) Cc: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , Stefan Farfeleder , svn-src-head@freebsd.org Subject: Re: svn commit: r221972 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2011 14:29:07 -0000 On May 22, 2011, at 11:29 PM, Andrey V. Elsukov wrote: > On 23.05.2011 6:29, Warner Losh wrote: >> Looking at one of my flash drives that shows the problem: >>=20 >> da0: 15423MB (31588351 512 byte sectors: 255H 63S/T 1966C) GEOM_PART: = partition 1 has end offset >> beyond last LBA: 31588350 > 31588325 >>=20 >> 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: >=20 >> I'm pretty sure this problem is due to a bug in g_part_mbr.c: >>=20 >> basetable->gpt_last =3D msize - (msize % basetable->gpt_sectors) - 1; >>=20 >> 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. >=20 > There is another opinion: > http://www.boot-us.com/gloss02.htm >=20 > "There is the convention that partitions should always start and end = on *cylinder boundaries*." The current code doesn't do that. The current code just ends on a track = boundary... > but >=20 > "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." >=20 > What way will we choose? We choose the way that works and not bother with alignment. It is an = artifact of the < 8GB disks and hasn't really been necessary for about = 15 years now. > 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). I think we agree. Allow, but do not force, alignment. Warner > --=20 > WBR, Andrey V. Elsukov >=20 > --=20 > WBR, Andrey V. Elsukov >=20