NetBSD Problem Report #49467

From www@NetBSD.org  Thu Dec 11 15:58:43 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 957D0A5864
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 11 Dec 2014 15:58:43 +0000 (UTC)
Message-Id: <20141211155841.9420CA6528@mollari.NetBSD.org>
Date: Thu, 11 Dec 2014 15:58:41 +0000 (UTC)
From: andrew.cagney@gmail.com
Reply-To: andrew.cagney@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Should disklabel.? refer to mbrlabel.? for how to update the disklable from the mbr?
X-Send-Pr-Version: www-1.0

>Number:         49467
>Category:       bin
>Synopsis:       Should disklabel.? refer to mbrlabel.? for how to update the disklable from the mbr?
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 11 16:00:00 +0000 2014
>Last-Modified:  Wed Dec 17 22:15:00 +0000 2014
>Originator:     Andrew Cagney
>Release:        7_BETA userland
>Organization:
>Environment:
With a current kernel: NetBSD morgan 7.99.2 NetBSD 7.99.2 (GENERIC) #21: Thu Nov 27 18:24:36 EST 2014  root@morgan:/home/netbsd/trunk/sys/arch/amd64/compile/obj/GENERIC amd64

>Description:
disklabel.? contains the text:

     disklabel will find, and update if requested, labels in the first 8k of
     type 169 (NetBSD) MBR labels and within the first 8k of the physical
     disk.  On other systems disklabel will only look at the start of the
     disk.  The offset at which the labels are written is also system
     dependent.

I don't believe this is correct.  If it is, it isn't clear how to do this.
Should it instead refer the user to mbrlabel (turns out using that is easy).

>How-To-Repeat:
install netbsd with some unused mbr space
install some other os (linux) onto that spare space
try to update netbsd's disklabel from the mbr information

>Fix:

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/49467: Should disklabel.? refer to mbrlabel.? for how to update the disklable from the mbr?
Date: Thu, 11 Dec 2014 18:49:25 +0000 (UTC)

 andrew.cagney@gmail.com writes:

 >     disklabel will find, and update if requested, labels in the first 8k of
 >     type 169 (NetBSD) MBR labels and within the first 8k of the physical
 >     disk.  On other systems disklabel will only look at the start of the
 >     disk.  The offset at which the labels are written is also system
 >     dependent.

 >I don't believe this is correct.  If it is, it isn't clear how to do this.

 It's strange language.

 The disklabel data structure on the disk is searched in the first 8k of
 type 169 MBR partitions and in the first 8k of the physical disk. This
 has nothing to do with the contents of the disklabel, only with the
 position of the data structure on disk.

 >Should it instead refer the user to mbrlabel (turns out using that is easy).

 mbrlabel is a tool that updates a disklabel from the MBR partition
 table. It changes the contents of the disklabel data structure.

From: Andrew Cagney <andrew.cagney@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/49467: Should disklabel.? refer to mbrlabel.? for how to
 update the disklable from the mbr?
Date: Thu, 11 Dec 2014 14:22:31 -0500

 On 11 December 2014 at 13:50, Michael van Elst <mlelstv@serpens.de> wrote:
 >  It's strange language.


 Ah, I stand corrected.

 Can disklabel still please mention mbrlabel explicitly as a way to get
 get the disklabel information back in-sync with the mbr label.

From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/49467: Should disklabel.? refer to mbrlabel.? for how to update the disklable from the mbr?
Date: Wed, 17 Dec 2014 22:10:08 +0000

 On Thu, Dec 11, 2014 at 07:25:00PM +0000, Andrew Cagney wrote:
 > Subject: Re: bin/49467: Should disklabel.? refer to mbrlabel.? for how to
 >  update the disklable from the mbr?
 > Date: Thu, 11 Dec 2014 14:22:31 -0500
 > 
 >  On 11 December 2014 at 13:50, Michael van Elst <mlelstv@serpens.de> wrote:
 >  >  It's strange language.

 Carefully crafted to be correct :-)

 >  Ah, I stand corrected.
 >  
 >  Can disklabel still please mention mbrlabel explicitly as a way to get
 >  get the disklabel information back in-sync with the mbr label.

 IIRC mbrlabel is likely to corrupt your netbsd disklabel.
 The i386/amd64 kernel will create an in-memory disklabel based on the
 mbr (and extended partition) if it can't find a netbsd label.
 If you have a type 169 mbr partition split into multiple netbsd partitions
 then mbrlabel will probably delete them.

 	David

 -- 
 David Laight: david@l8s.co.uk

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.