NetBSD Problem Report #54088

From martin@duskware.de  Fri Mar 29 16:42:09 2019
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5C0B77A111
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 29 Mar 2019 16:42:09 +0000 (UTC)
Message-Id: <20190329164157.9617A5CC86C@emmas.aprisoft.de>
Date: Fri, 29 Mar 2019 17:41:57 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: "gpt destroy" does not completely destroy the GPT
X-Send-Pr-Version: 3.95

>Number:         54088
>Category:       bin
>Synopsis:       "gpt destroy" does not completely destroy the GPT
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 29 16:45:00 +0000 2019
>Closed-Date:    Thu Apr 04 14:06:16 +0000 2019
>Last-Modified:  Thu Apr 04 14:06:16 +0000 2019
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.36
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD night-owl.duskware.de 8.99.36 NetBSD 8.99.36 (NIGHT-OWL) #659: Fri Mar 29 16:52:48 CET 2019 martin@night-owl.duskware.de:/usr/src/sys/arch/amd64/compile/NIGHT-OWL amd64
Architecture: x86_64
Machine: amd64
>Description:

(NB: marked critical/high priority as this behaviour causes un-intuitive
sysinst behaviour in a soon-to-be commited sysinst update)

When removing the GPT from a disk with the "gpt destroy" command, the main
GPT is removed, but the protective MBR is left.

This is very counter intuitive and IMO useless. Changing the code is easy,
but I am not sure why this behaviour has been implemented.

>How-To-Repeat:

dd if=/dev/zero of=disk.img seek=6g count=1
vnconfig -c vnd0 disk.img
gpt create vnd0
gpt destroy vnd0
fdisk vnd0

>Fix:
Woraround is to add a "dd if=/dev/zero count=100" after gpt destroy.
I volunteer to do the code change if consensus is to zero the PMBR.

>Release-Note:

>Audit-Trail:
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54088 CVS commit: src/sbin/gpt
Date: Thu, 4 Apr 2019 14:03:40 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Thu Apr  4 14:03:40 UTC 2019

 Modified Files:
 	src/sbin/gpt: destroy.c

 Log Message:
 PR bin/54088: make "destroy" remove the protective MBR too.
 We could make this optional if someone comes up with a good reason
 to leave it intact.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.12 src/sbin/gpt/destroy.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Thu, 04 Apr 2019 14:06:16 +0000
State-Changed-Why:
Fixed


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.