Subject: bin/466: i386 disklabel STILL clobbers DOS part. table!
To: None <gnats-admin>
From: Rafal Boni <rafal@rafal.slip.uiuc.edu>
List: netbsd-bugs
Date: 09/08/1994 14:05:29
>Number: 466
>Category: bin
>Synopsis: i386 disklabel STILL clobbers DOS part table if exists!
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: gnats-admin (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Sep 8 14:05:24 1994
>Originator: Rafal Boni
>Organization:
...me organized?? Huh!
>Release: 1.0_BETA as of 9/1
>Environment:
System: NetBSD rafal.slip.uiuc.edu 1.0_BETA NetBSD 1.0_BETA (RAFAL) #4: Mon Sep 5 19:15:47 CDT 1994 rafal@rafal.slip.uiuc.edu:/usr/src/sys/arch/i386/compile/RAFAL i386
No SCSI, 2 x ESDI drives [wd0 and wd1], both shared with MS-DOS.
>Description:
The i386 disklabel will now ask you if you want to clobber your MBR,
but there is NO way to [re-]label disks without doing so...
The disklabel program had a hardcoded reference to the c partition
as the raw partition in one of the #if i386 blocks. As a result, the
sanity checks that followed would almost always fail... and the only
way to then do the labeling would be to trash the DOS MBR.
On top of this, restoring the DOS MBR would nullify the labeling done
above since it was written to the wrong place!
>How-To-Repeat:
On a disk shared between DOS and BSD [and whose MBR you have saved],
do a "disklabel -B <drive>".
Watch the label be written out on top of the DOS MBR, thus trashing it
INSTEAD of to the 'd' partition of said drive.
>Fix:
In /usr/src/sbin/disklabel apply following patch, which also clarifies
the goofy message you get when disklabel IS about to clobber your DOS
MBR:
*** disklabel.c.old Wed Sep 7 04:07:27 1994
--- disklabel.c Wed Sep 7 04:05:41 1994
***************
*** 387,393 ****
lp->d_checksum = dkcksum(lp);
if (rflag) {
#ifdef i386
! struct partition *pp = &lp->d_partitions[2];
/*
* If NetBSD/i386 DOS partition is missing, or if
* the label to be written is not within partition,
--- 387,393 ----
lp->d_checksum = dkcksum(lp);
if (rflag) {
#ifdef i386
! struct partition *pp = &lp->d_partitions[RAWPARTITION - 'a'];
/*
* If NetBSD/i386 DOS partition is missing, or if
* the label to be written is not within partition,
***************
*** 404,410 ****
if (dosdp) {
int c;
! printf("overwriting disk with DOS partition table? (n): ");
fflush(stdout);
c = getchar();
if (c != EOF && c != '\n')
--- 404,410 ----
if (dosdp) {
int c;
! printf("overwrite DOS partition table? (n): ");
fflush(stdout);
c = getchar();
if (c != EOF && c != '\n')
>Audit-Trail:
>Unformatted:
------------------------------------------------------------------------------