NetBSD Problem Report #43454

From gregoire.sutre@labri.fr  Fri Jun 11 08:00:04 2010
Return-Path: <gregoire.sutre@labri.fr>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 3CF5563B935
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 11 Jun 2010 08:00:04 +0000 (UTC)
Message-Id: <20100611075305.2AEEC1233D@niagara.localdomain>
Date: Fri, 11 Jun 2010 09:53:05 +0200 (CEST)
From: gregoire.sutre@gmail.com
Reply-To: gregoire.sutre@gmail.com
To: gnats-bugs@gnats.NetBSD.org
Subject: gpt(8) and disklabel(8) conflict with each other
X-Send-Pr-Version: 3.95

>Number:         43454
>Category:       bin
>Synopsis:       gpt(8) and disklabel(8) conflict with each other
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 11 08:05:00 +0000 2010
>Last-Modified:  Fri Jun 11 10:20:02 +0000 2010
>Originator:     Grégoire Sutre <gregoire.sutre@gmail.com>
>Release:        NetBSD 5.1_RC2
>Organization:
>Environment:
System: NetBSD niagara 5.1_RC2 NetBSD 5.1_RC2 (NIAGARA) #0: Thu Jun 10 00:19:14 CEST 2010 instsoft@niagara:/usr/build/usr/src/sys/arch/i386/compile/NIAGARA i386
Architecture: i386
Machine: i386
>Description:

On a gpt-partitioned disk, running disklabel -e -I silently destroys the GPT
header.

Conversely, on a BSD-labeled disk (with a BSD label for the whole disk, i.e.
no DOS partition table in the MBR), running gpt create silently create destroys
the BSD disklabel.

>How-To-Repeat:

$ dd if=/dev/zero of=./testimage.bin bs=10m count=1
$ vnconfig vnd0 testimage.bin

// Create a new BSD disklabel
$ disklabel -e -I vnd0

// Check that the disklabel has been written to the disk
$ disklabel -r vnd0
[ shows the disklabel ]

// Create a new GUID partition table
$ gpt create vnd0

// Observe that the on-disk disklabel was destroyed
$ disklabel -r vnd0
disklabel: could not read existing label


Conversely:

$ dd if=/dev/zero of=./testimage.bin bs=10m count=1
$ vnconfig vnd0 testimage.bin

// Create a new GUID partition table
$ gpt create vnd0

// Add a new GPT partition
$ gpt add -s 10000 vnd0

// Read the GPT to check that the new partition is there
$ gpt show vnd0

// Create a new BSD disklabel
$ disklabel -e -I vnd0

// Observe that the GPT header was destroyed
$ gpt show vnd0
  start   size  index  contents
      0      1         PMBR
      1  20446
  20447     32         Sec GPT table
  20479      1         Sec GPT header


>Fix:


>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: bin/43454: gpt(8) and disklabel(8) conflict with each other
Date: Fri, 11 Jun 2010 12:00:56 +0200

 On Fri, Jun 11, 2010 at 08:05:00AM +0000, gregoire.sutre@gmail.com wrote:
 > On a gpt-partitioned disk, running disklabel -e -I silently destroys the GPT
 > header.
 > 
 > Conversely, on a BSD-labeled disk (with a BSD label for the whole disk, i.e.
 > no DOS partition table in the MBR), running gpt create silently create destroys
 > the BSD disklabel.

 Yes - but what is the bug in this behaviour? You want a warning prompt?

 Martin

From: =?ISO-8859-1?Q?Gr=E9goire_Sutre?= <gregoire.sutre@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/43454: gpt(8) and disklabel(8) conflict with each other
Date: Fri, 11 Jun 2010 12:09:51 +0200

 On 06/11/2010 12:05, Martin Husemann wrote:
 > The following reply was made to PR bin/43454; it has been noted by GNATS.
 >
 > From: Martin Husemann<martin@duskware.de>
 > To: gnats-bugs@NetBSD.org
 > Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
 > Subject: Re: bin/43454: gpt(8) and disklabel(8) conflict with each other
 > Date: Fri, 11 Jun 2010 12:00:56 +0200
 >
 >   On Fri, Jun 11, 2010 at 08:05:00AM +0000, gregoire.sutre@gmail.com wrote:
 >   >  On a gpt-partitioned disk, running disklabel -e -I silently destroys the GPT
 >   >  header.
 >   >
 >   >  Conversely, on a BSD-labeled disk (with a BSD label for the whole disk, i.e.
 >   >  no DOS partition table in the MBR), running gpt create silently create destroys
 >   >  the BSD disklabel.
 >
 >   Yes - but what is the bug in this behaviour? You want a warning prompt?

 Yes, a warning prompt would be nice.  Or abort by default when the tool
 detects some valid data (gpt header for disklabel(8), bsd label for
 gpt(8)), and have an option (unfortunately -f is already taken) to
 force the writing.

 Grégoire

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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.