From owner-freebsd-bugs Fri Aug 16 10:49:59 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4E14D37B400 for ; Fri, 16 Aug 2002 10:49:55 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 69C9643E65 for ; Fri, 16 Aug 2002 10:49:54 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id RAA27443; Fri, 16 Aug 2002 17:49:44 GMT Date: Sat, 17 Aug 2002 03:56:57 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "Artem 'Zazoobr' Ignatjev" Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/20633: fdisk doesn't handle LBA correctly In-Reply-To: <200208161300.g7GD0F30086054@freefall.freebsd.org> Message-ID: <20020817034701.A8051-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Fri, 16 Aug 2002, Artem 'Zazoobr' Ignatjev wrote: > The following reply was made to PR bin/20633; it has been noted by GNATS. > > From: "Artem 'Zazoobr' Ignatjev" > To: freebsd-gnats-submit@FreeBSD.org, sjr@home.com > Cc: > Subject: Re: bin/20633: fdisk doesn't handle LBA correctly > Date: Fri, 16 Aug 2002 16:56:01 +0400 > > Hi, if I understand what jhb said in audit trail, following patch > should solve the issue. Stephen, if it still bothers you, could you try > it? > > --- sbin/i386/fdisk/fdisk.c Fri Aug 16 16:24:27 2002 > +++ sbin/i386/fdisk/fdisk.c Fri Aug 16 16:33:28 2002 > @@ -468,13 +468,21 @@ > part_mb, > partp->dp_flag, > partp->dp_flag == ACTIVE ? " (active)" : ""); > - printf("\tbeg: cyl %d/ head %d/ sector %d;\n\tend: cyl %d/ head %d/ sector %d\n" > - ,DPCYL(partp->dp_scyl, partp->dp_ssect) > - ,partp->dp_shd > - ,DPSECT(partp->dp_ssect) > - ,DPCYL(partp->dp_ecyl, partp->dp_esect) > - ,partp->dp_ehd > - ,DPSECT(partp->dp_esect)); > + /* > + * if C/H/S of start or end are all set to 0xff, then C/H/S don't have > + * enough bits to hold the address, and one should use LBA instead. > + */ > + if ((partp->dp_scyl != 0xff || partp->dp_ssect != 0xff || > + partp->dp_shd != 0xff) && (partp->dp_ecyl != 0xff || > + partp->dp_esect != 0xff || partp->dp_ehd != 0xff)) > + printf("\tbeg: cyl %d/ head %d/ sector %d;\n" > + "\tend: cyl %d/ head %d/ sector %d\n" > + ,DPCYL(partp->dp_scyl, partp->dp_ssect) > + ,partp->dp_shd > + ,DPSECT(partp->dp_ssect) > + ,DPCYL(partp->dp_ecyl, partp->dp_esect) > + ,partp->dp_ehd > + ,DPSECT(partp->dp_esect)); > } Fdisk should print these values, at least optionally, since they are needed for debugging. The magic values might be non-magic on old systems. Also, the usual magic number of cylinders seems to be 1022, not 1023. Writing the correct magic numbers is more interesting. fdisk(8) doesn't support it directly. You may have to change the C/H/S values to the magic ones manually. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message