*BSD News Article 5263


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!spool.mu.edu!uunet!europa.asd.contel.com!awds.imsd.contel.com!wlbr!voder!nsc!amdahl!JUTS!griffin!gab10
From: gab10@griffincd.amdahl.com (Gary A Browning)
Newsgroups: comp.unix.bsd
Subject: Problems with disklabel and a minor patch
Keywords: bug disklabel patch
Message-ID: <823g02AH22U501@JUTS.ccc.amdahl.com>
Date: 18 Sep 92 18:29:53 GMT
Sender: netnews@ccc.amdahl.com
Organization: Amdahl Corporation, Sunnyvale CA
Lines: 42

I was having trouble creating a label on my second hard disk that wouldn't
wipe out the DOS label.  It turns out that if you have not set an active
partition on the SECOND drive, the disklabel program thinks that the DOS
partition table is invalid and promptly, and without warning, assumes it
owns the whole disk.  It then writes it's label over the DOS partition table.
I am not sure what it even means to have an active partition on the second
since DOS will not boot from there anyway.

So I patched the disklabel to be more reasonable - a valid DOS parition no 
longer must have exactly one active partition.  This is certainly not a
required patch.  The workaround is to always remember to have an active
partition on each disk.

It might be better to have a flag which specifies that 386BSD owns just
a partition or the whole disk, and that it should not make any,
potentially
damaging, assumptions.

*** orig/disklabel.c	Wed Sep  2 00:08:25 1992
--- disklabel.c	Wed Sep  2 00:22:52 1992
***************
*** 524,530 ****
  	}
  
  	/* valid partition table? */
! 	if (nboot != 1 || npart == 0 || njunk)
  		return (0);
  	/* if no bsd partition, pass back first one */
  	if (!bsdp) {
--- 524,530 ----
  	}
  
  	/* valid partition table? */
! 	if (npart == 0 || njunk)
  		return (0);
  	/* if no bsd partition, pass back first one */
  	if (!bsdp) {

-- 
Gary Browning        | Exhilaration is that feeling you get just after a
		     | great idea hits you, and just before you realize
                     | what is wrong with it.