From nobody@FreeBSD.org  Fri Dec  8 07:53:04 2000
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id DC46537B400
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  8 Dec 2000 07:53:03 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id eB8Fr3853015;
	Fri, 8 Dec 2000 07:53:03 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200012081553.eB8Fr3853015@freefall.freebsd.org>
Date: Fri, 8 Dec 2000 07:53:03 -0800 (PST)
From: didier.poirot@sun.com
Sender: nobody@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: newfs_msdos breaks the DOS partition table (and BSD label sector)
X-Send-Pr-Version: www-1.0

>Number:         23380
>Category:       i386
>Synopsis:       newfs_msdos breaks the DOS partition table (and BSD label sector)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    rnordier
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 08 08:00:04 PST 2000
>Closed-Date:    Fri Dec 8 11:15:51 PST 2000
>Last-Modified:  Fri Dec 08 11:17:53 PST 2000
>Originator:     Poirot
>Release:        4.1
>Organization:
Sun Microsystems
>Environment:
FreeBSD bongo 4.0-RELEASE FreeBSD 4.0-RELEASE #11: Fri Dec  8 16:37:27 CET 2000     dp@bongo:/usr/src/sys/compile/GENERIC  i386

>Description:
Installing a MSDOS filesystem with the newfs_msdos(1) utility in the
first partition of the first slice (e.g /dev/ad0s1a) of a disk breaks 
the DOS partition table contained in the sector 0 of the disk (the MBR). 

Note: the partition 'a' must start at the beginning of the slice, e.g
the oa# field of the disktab entry must be set to 0.

The newfs_msdos utility writes to 'absolute' sector 0 of the disk, 
instead of writing to 'relative' sector 0 (relative to beginning of the
slice, not of the disk). It also tries to write to 'absolute' sector
1 (which contain the BSD label), must access is denied by the system.


>How-To-Repeat:
1. Using fdisk(1) create 1 slice( e.g ad0s1), starting at 0, type 165
2. Using disklabel, write a label to the disk slice mentionned above.
   This label should contain a partition starting at 0.
3. Use newfs_msdos on this partition (e.g /dev/ad0s1a).
4. Try to re-read the DOS partition table with fdisk.

>Fix:
The disktab entry used must not start at offset 0 in the slice, but say
at 16.



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->rnordier 
Responsible-Changed-By: rnordier 
Responsible-Changed-When: Fri Dec 8 10:40:44 PST 2000 
Responsible-Changed-Why:  
newfs_msdos is mine. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=23380 

From: Robert Nordier <rnordier@nordier.com>
To: didier.poirot@sun.com
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: i386/23380: newfs_msdos breaks the DOS partition table (and BSD label sector)
Date: Fri, 8 Dec 2000 21:04:44 +0200 (SAST)

 didier.poirot@sun.com wrote:
  
 > >Number:         23380
 > >Category:       i386
 > >Synopsis:       newfs_msdos breaks the DOS partition table (and BSD label sector)
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    freebsd-bugs
 
 > >Description:
 > Installing a MSDOS filesystem with the newfs_msdos(1) utility in the
 > first partition of the first slice (e.g /dev/ad0s1a) of a disk breaks 
 > the DOS partition table contained in the sector 0 of the disk (the MBR). 
 > 
 > Note: the partition 'a' must start at the beginning of the slice, e.g
 > the oa# field of the disktab entry must be set to 0.
 > 
 > The newfs_msdos utility writes to 'absolute' sector 0 of the disk, 
 > instead of writing to 'relative' sector 0 (relative to beginning of the
 > slice, not of the disk). It also tries to write to 'absolute' sector
 > 1 (which contain the BSD label), must access is denied by the system.
 > 
 > 
 > >How-To-Repeat:
 > 1. Using fdisk(1) create 1 slice( e.g ad0s1), starting at 0, type 165
 > 2. Using disklabel, write a label to the disk slice mentionned above.
 >    This label should contain a partition starting at 0.
 > 3. Use newfs_msdos on this partition (e.g /dev/ad0s1a).
 > 4. Try to re-read the DOS partition table with fdisk.
 > 
 > >Fix:
 > The disktab entry used must not start at offset 0 in the slice, but say
 > at 16.
 
 The problems you are experiencing appear to be due to pilot error.
 
 You should not create a DOS filesystem inside a BSD partition.  Most
 typically, you would create one or more slices on your hard drive
 (using fdisk or sysinstall) and then (without using disklabel) create
 a DOS filesystem on one of the slices, for instance on /dev/ad0s1.
 
 Your slices should also not begin at sector 0 of the disk.  Typically, 
 they would begin at sector 63 on a modern IDE disk.
 
 -- 
 Robert Nordier
 
 rnordier@nordier.com
 rnordier@FreeBSD.org
 
State-Changed-From-To: open->closed 
State-Changed-By: rnordier 
State-Changed-When: Fri Dec 8 11:15:51 PST 2000 
State-Changed-Why:  
The problem appears to be due to slice/partition layout rather 
than to newfs_msdos. 

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