From nobody@FreeBSD.org  Sat Feb 26 00:04:41 2000
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21])
	by hub.freebsd.org (Postfix) with ESMTP id 9DF1537BF6D
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 26 Feb 2000 00:04:41 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.9.3/8.9.2) id AAA73118;
	Sat, 26 Feb 2000 00:04:41 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Message-Id: <200002260804.AAA73118@freefall.freebsd.org>
Date: Sat, 26 Feb 2000 00:04:41 -0800 (PST)
From: eps@sirius.com
Sender: nobody@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: dscheck() overzealously protects labels on non-BSD partitions
X-Send-Pr-Version: www-1.0

>Number:         17003
>Category:       kern
>Synopsis:       dscheck() overzealously protects labels on non-BSD partitions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 26 00:10:01 PST 2000
>Closed-Date:    Sun Apr 17 21:06:34 GMT 2005
>Last-Modified:  Sun Apr 17 21:06:34 GMT 2005
>Originator:     Eric P. Scott
>Release:        i386/3.4-RELEASE
>Organization:
>Environment:
>Description:
On a drive using DOS partitioning, dscheck() prevents overwriting the
first 1K of a partition that formerly held a UFS filesystem, even if
the partition type is changed to something other than DOSPTYP_386BSD.
>How-To-Repeat:
dd if=/dev/zero of=/dev/rwd0s2 bs=512 count=1
>Fix:
Ignore contents of non-BSD partitions.  Don't even call
readdisklabel().

Relevant files: diskslice_machdep.c subr_diskslice.c ufs_disksubr.c

>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: eps@sirius.com
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/17003: dscheck() overzealously protects labels on non-BSD
 partitions
Date: Sat, 26 Feb 2000 21:24:01 +1100 (EST)

 On Sat, 26 Feb 2000 eps@sirius.com wrote:
 
 > On a drive using DOS partitioning, dscheck() prevents overwriting the
 > first 1K of a partition that formerly held a UFS filesystem, even if
 
 It actually prevents overwriting the second sector.  This prevents
 overwriting the first nK if the write is for nK at offset 0 and the
 sector size is < nK.
 
 > the partition type is changed to something other than DOSPTYP_386BSD.
 
 This is a feature.  All types of partitions can have BSD labels.  This
 part of the feature is intentional.  If you don't want your otherOS
 partitions labeled, then don't put a label on them, and don't forget
 to remove unwanted labels if you change partition types.  Also, be
 careful when moving partitions.  An old label will wake up if there
 is a valid one in the second sector of a new partition.
 
 Labels can be difficult to remove, because of bugs in the label write
 (un)protection ioctl.  The only reliable method that I know of is:
 1) Open the whole disk device for the drive, and write suitable garbage
    (normally 0's) over the label sector.  If you use dd, then you will
    need an up to date dd that supports seeking to offsets >= 2GB if the
    label sector offset is >= 2GB.
 2) Make sure that all subdevices on the drive are closed.  An in-core
    copy of the old label will be used until the next open after they
    are all closed.
 
 Bruce
 
 
State-Changed-From-To: open->closed 
State-Changed-By: iedowse 
State-Changed-When: Sun Apr 17 21:03:38 GMT 2005 
State-Changed-Why:  

Sorry, this is unlikely to be fixed now in 4.x, and the partition 
code in 5.x and -CURRENT is completely different so should not have 
this behaviour. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=17003 
>Unformatted:
