Date: Sat, 17 Aug 2002 03:56:57 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: "Artem 'Zazoobr' Ignatjev" <timon@memphis.mephi.ru> Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/20633: fdisk doesn't handle LBA correctly Message-ID: <20020817034701.A8051-100000@gamplex.bde.org> In-Reply-To: <200208161300.g7GD0F30086054@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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" <timon@memphis.mephi.ru> > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020817034701.A8051-100000>