NetBSD Problem Report #51216

From www@NetBSD.org  Sat Jun  4 22:45:32 2016
Return-Path: <www@NetBSD.org>
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 "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 477427A210
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  4 Jun 2016 22:45:32 +0000 (UTC)
Message-Id: <20160604224531.4FFF37AABE@mollari.NetBSD.org>
Date: Sat,  4 Jun 2016 22:45:31 +0000 (UTC)
From: m33@tok715.net
Reply-To: m33@tok715.net
To: gnats-bugs@NetBSD.org
Subject: Can't create wedges on a large (3TB) disk, gpt is ok but dkctl gives an error message
X-Send-Pr-Version: www-1.0

>Number:         51216
>Category:       port-amd64
>Synopsis:       Can't create wedges on a large (3TB) disk, gpt is ok but dkctl gives an error message
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-amd64-maintainer
>State:          closed
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 04 22:50:00 +0000 2016
>Closed-Date:    Sat Jun 18 20:11:35 +0000 2016
>Last-Modified:  Sun Jan 29 05:20:01 +0000 2017
>Originator:     ML
>Release:        7.0.1
>Organization:
>Environment:
NetBSD nxxxxt 7.0.1 NetBSD 7.0.1 (GENERIC.201605221355Z) amd64

>Description:
[ Can't create wedges on a 3TB disk, dkctl error message ]


I follow this tutorial : https://wiki.netbsd.org/users/mlelstv/using-large-disks/ with the GPT + Wedges solution to partition a large disk.

Note: This disk is brand new and functional. 

dmesg output:
wd1 at atabus3 drive 0
wd1: <WDC WD30PURX-64P6ZY0>
wd1: drive supports 16-sector PIO transfers, LBA48 addressing
wd1: 2794 GB, 5814021 cyl, 16 head, 63 sec, 512 bytes/sect x 5860533168 sectors
wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
wd1(ahcisata0:1:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133) (using DMA)


This is how I get there:

# dd if=/dev/zero of=/dev/wd1 bs=1m count=10
10+0 records in
10+0 records out
10485760 bytes transferred in 0.025 secs (419430400 bytes/sec)

# gpt show wd1
  start   size  index  contents
      0  20480         

# gpt create wd1

# gpt show wd1
  start   size  index  contents
      0      1         PMBR
      1      1         Pri GPT header
      2     32         Pri GPT table
     34  20413         
  20447     32         Sec GPT table
  20479      1         Sec GPT header

# gpt add -a 32k -l wdc3twdg -t ffs wd1
Partition 1 added, use:
        dkctl wd1 addwedge <wedgename> 64 20352 <type>
to create a wedge for it

# gpt show wd1
  start   size  index  contents
      0      1         PMBR
      1      1         Pri GPT header
      2     32         Pri GPT table
     34     30         
     64  20352      1  GPT part - NetBSD FFSv1/FFSv2
  20416     31         
  20447     32         Sec GPT table
  20479      1         Sec GPT header

<reboot to reload all this stuff>

# gpt show wd1
  start   size  index  contents
      0      1         PMBR
      1      1         Pri GPT header
      2     32         Pri GPT table
     34     30         
     64  20352      1  GPT part - NetBSD FFSv1/FFSv2
  20416     31         
  20447     32         Sec GPT table
  20479      1         Sec GPT header

# dkctl wd1 addwedge wdgwdc3t 64 20352 ffs
dkctl: /dev/rwd1: addwedge: Inappropriate ioctl for device


Find the dkctl ktruss trace : http://pastebin.com/sqe1G5jB

Am I missing something ?
>How-To-Repeat:
dd zero on the fist megabyte of wd1
reboot
start again with gpt
fail at dkctl wd1 makedeges
>Fix:
Workaround: disklabel and force huge size partition. 
I don't like it much.

>Release-Note:

>Audit-Trail:
From: "J. Hannken-Illjes" <hannken@eis.cs.tu-bs.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-amd64/51216: Can't create wedges on a large (3TB) disk, gpt is ok but dkctl gives an error message
Date: Mon, 6 Jun 2016 11:52:31 +0200

 > On 05 Jun 2016, at 00:50, m33@tok715.net wrote:
 >=20
 >> Number:         51216
 <snip>
 > This is how I get there:
 >=20
 > # dd if=3D/dev/zero of=3D/dev/wd1 bs=3D1m count=3D10

 You meant =E2=80=9C/dev/rwd1d=E2=80=9D, which is a raw device.

 This command created =E2=80=9C/dev/wd1=E2=80=9D as a plain file of size =
 10 MB.

 Please remove /dev/wd1 and retry with =E2=80=9Cdd .. of=3D/dev/rwd1d =
 ..=E2=80=9D.

 --
 J. Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)

From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: tech-kern@netbsd.org
Subject: Re: port-amd64/51216: Can't create wedges on a large (3TB) disk, gpt is ok but dkctl gives an error message
Date: Mon, 06 Jun 2016 17:39:11 +0700

     Date:        Mon,  6 Jun 2016 09:55:00 +0000 (UTC)
     From:        "J. Hannken-Illjes" <hannken@eis.cs.tu-bs.de>
     Message-ID:  <20160606095500.F2DD47AAB9@mollari.NetBSD.org>

   | From: "J. Hannken-Illjes" <hannken@eis.cs.tu-bs.de>
   | Subject: Re: port-amd64/51216: Can't create wedges on a large (3TB) disk,
   |              gpt is ok but dkctl gives an error message

   |  > This is how I get there:
   |  > # dd if=/dev/zero of=/dev/wd1 bs=1m count=10
   |  
   |  You meant /dev/rwd1d, which is a raw device.

 [for the purpose, whether the raw or block device was used wouldn't really
 make much difference I suspect, it is the 'd' on the end which matters.]

 I wonder if now that wedges are becoming used more, and wdNx (and sdNx)
 thus used less, if perhaps we should start creating /dev/[sw]dN and
 /dev/r[sw]dN as aliases of (or links to) /dev/[r][sw]dN[cd] (as appropriate)
 (ie /dev/wd1 is a link to /dev/wd1d on i386 (etc) or /dev/wd1c (on sparc etc))

 ?

 And of course for all the other disk, and disk like devices (raid, cgd, ...)

 This would also mean less issues with having to try to explain to people
 that they need to figure out which partition (c or d) is RAWPART and use
 the right one - MAKEDEV would need to know, but just about everything else
 could get itself out of the discover RAWPART dance, and just use the device
 name.

 kre

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/51216: Can't create wedges on a large (3TB) disk, gpt is ok but dkctl gives an error message
Date: Mon, 6 Jun 2016 16:28:54 +0000 (UTC)

 kre@munnari.OZ.AU (Robert Elz) writes:

 > I wonder if now that wedges are becoming used more, and wdNx (and sdNx)
 > thus used less, if perhaps we should start creating /dev/[sw]dN and
 > /dev/r[sw]dN as aliases of (or links to) /dev/[r][sw]dN[cd] (as appropriate)
 > (ie /dev/wd1 is a link to /dev/wd1d on i386 (etc) or /dev/wd1c (on sparc etc))


 Maybe, but much of the confusion must have come from using commands in the /dev
 directory. Tools like gpt interpret device names (e.g. wd0) and automatically
 select the raw device.... unless there is a file 'wd0' in the local directory.

 That functionality should be changed. If you need a file in the local directory
 it should be written like ./wd0.

 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, port-amd64-maintainer@netbsd.org, 
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, m33@tok715.net
Cc: 
Subject: Re: port-amd64/51216: Can't create wedges on a large (3TB) disk, gpt is ok but dkctl gives an error message
Date: Mon, 6 Jun 2016 12:48:57 -0400

 On Jun 6,  4:35pm, mlelstv@serpens.de (Michael van Elst) wrote:
 -- Subject: Re: port-amd64/51216: Can't create wedges on a large (3TB) disk, 

 |  Maybe, but much of the confusion must have come from using commands in the /dev
 |  directory. Tools like gpt interpret device names (e.g. wd0) and automatically
 |  select the raw device.... unless there is a file 'wd0' in the local directory.
 |  
 |  That functionality should be changed. If you need a file in the local directory
 |  it should be written like ./wd0.

 Yes, this has caused problems before! Let's change it.

 christos

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, m33@tok715.net
Subject: re: port-amd64/51216: Can't create wedges on a large (3TB) disk, gpt is ok but dkctl gives an error message
Date: Tue, 07 Jun 2016 03:10:01 +1000

 Michael van Elst writes:
 > The following reply was made to PR port-amd64/51216; it has been noted b=
 y GNATS.
 > =

 > From: mlelstv@serpens.de (Michael van Elst)
 > To: gnats-bugs@netbsd.org
 > Cc: =

 > Subject: Re: port-amd64/51216: Can't create wedges on a large (3TB) disk=
 , gpt is ok but dkctl gives an error message
 > Date: Mon, 6 Jun 2016 16:28:54 +0000 (UTC)
 > =

 >  kre@munnari.OZ.AU (Robert Elz) writes:
 >  =

 >  > I wonder if now that wedges are becoming used more, and wdNx (and sdN=
 x)
 >  > thus used less, if perhaps we should start creating /dev/[sw]dN and
 >  > /dev/r[sw]dN as aliases of (or links to) /dev/[r][sw]dN[cd] (as appro=
 priate)
 >  > (ie /dev/wd1 is a link to /dev/wd1d on i386 (etc) or /dev/wd1c (on sp=
 arc etc))
 >  =

 >  =

 >  Maybe, but much of the confusion must have come from using commands in =
 the /dev
 >  directory. Tools like gpt interpret device names (e.g. wd0) and automat=
 ically
 >  select the raw device.... unless there is a file 'wd0' in the local dir=
 ectory.
 >  =

 >  That functionality should be changed. If you need a file in the local d=
 irectory
 >  it should be written like ./wd0.

 i like both of these ideas.

 - it avoids the accidental file creation in /dev =

 - it avoids odd errors when you have files called "wd0" lying around
   that aren't disks..


 .mrg.

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51216 CVS commit: src/lib/libutil
Date: Mon, 6 Jun 2016 13:50:19 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Jun  6 17:50:19 UTC 2016

 Modified Files:
 	src/lib/libutil: opendisk.3 opendisk.c

 Log Message:
 PR/51216: Instead of trying to open files in the current working
 directory first for paths that don't contain "/", first try the
 /dev paths to avoid confusion with files in the working directory
 that happen to match disk names.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.12 src/lib/libutil/opendisk.3
 cvs rdiff -u -r1.13 -r1.14 src/lib/libutil/opendisk.c

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

From: m33 <m33@tok715.net>
To: gnats-bugs@netbsd.org
Cc: port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: re: port-amd64/51216: Can't create wedges on a large (3TB) disk, gpt
 is ok but dkctl gives an error message
Date: Mon, 06 Jun 2016 20:03:38 +0200

 Le 06-06-2016 19:15, matthew green a écrit :
 > The following reply was made to PR port-amd64/51216; it has been noted 
 > by GNATS.
 > 
 > From: matthew green <mrg@eterna.com.au>
 > To: gnats-bugs@NetBSD.org
 > Cc: port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,
 >     netbsd-bugs@netbsd.org, m33@tok715.net
 > Subject: re: port-amd64/51216: Can't create wedges on a large (3TB)
 > disk, gpt is ok but dkctl gives an error message
 > Date: Tue, 07 Jun 2016 03:10:01 +1000
 > 
 >  Michael van Elst writes:
 >  > The following reply was made to PR port-amd64/51216; it has been 
 > noted b=
 >  y GNATS.
 >  > =
 > 
 >  > From: mlelstv@serpens.de (Michael van Elst)
 >  > To: gnats-bugs@netbsd.org
 >  > Cc: =
 > 
 >  > Subject: Re: port-amd64/51216: Can't create wedges on a large (3TB) 
 > disk=
 >  , gpt is ok but dkctl gives an error message
 >  > Date: Mon, 6 Jun 2016 16:28:54 +0000 (UTC)
 >  > =
 > 
 >  >  kre@munnari.OZ.AU (Robert Elz) writes:
 >  >  =
 > 
 >  >  > I wonder if now that wedges are becoming used more, and wdNx (and 
 > sdN=
 >  x)
 >  >  > thus used less, if perhaps we should start creating /dev/[sw]dN 
 > and
 >  >  > /dev/r[sw]dN as aliases of (or links to) /dev/[r][sw]dN[cd] (as 
 > appro=
 >  priate)
 >  >  > (ie /dev/wd1 is a link to /dev/wd1d on i386 (etc) or /dev/wd1c 
 > (on sp=
 >  arc etc))
 >  >  =
 > 
 >  >  =
 > 
 >  >  Maybe, but much of the confusion must have come from using commands 
 > in =
 >  the /dev
 >  >  directory. Tools like gpt interpret device names (e.g. wd0) and 
 > automat=
 >  ically
 >  >  select the raw device.... unless there is a file 'wd0' in the local 
 > dir=
 >  ectory.
 >  >  =
 > 
 >  >  That functionality should be changed. If you need a file in the 
 > local d=
 >  irectory
 >  >  it should be written like ./wd0.
 > 
 >  i like both of these ideas.
 > 
 >  - it avoids the accidental file creation in /dev =
 > 
 >  - it avoids odd errors when you have files called "wd0" lying around
 >    that aren't disks..
 > 
 > 
 >  .mrg.


 Thanks for your help, I will give it a try with carefull devices name 
 verification.

 My 2 cents: anything that helps avoid such confusion, and promotes using 
 modern/new commands will benefits to newcomers.
 And maybe long time users too, who get new hardware in the amd64 port 
 (with uefi and new boot process... large disks... tons of cpu cores for 
 virtual machines...).

From: "Robert Elz" <kre@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51216 CVS commit: src/etc
Date: Thu, 16 Jun 2016 15:33:39 +0000

 Module Name:	src
 Committed By:	kre
 Date:		Thu Jun 16 15:33:39 UTC 2016

 Modified Files:
 	src/etc: MAKEDEV.tmpl

 Log Message:
 As discussed at the biginning of last week (June 6 & 7, 2016) on
 tech-kern in messages with a Subject starting [Re:] /dev/sdN -> /dev/sdN[cd]
 and in PR port-amd64/51216 :

 Create bare (no letter suffix) device names (block & raw) that
 refer to the raw device ('c' or 'd' partition as appropriate).

 This commit was delayed waiting to see if there was to be any more
 discussion - there wasn't a lot.

 Caution: this is going to consume 2 more inodes per disc device
 configured, everywhere that devices are configured using MAKEDEV


 To generate a diff of this commit:
 cvs rdiff -u -r1.180 -r1.181 src/etc/MAKEDEV.tmpl

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

State-Changed-From-To: open->feedback
State-Changed-By: kre@NetBSD.org
State-Changed-When: Thu, 16 Jun 2016 15:43:17 +0000
State-Changed-Why:
Is there a need to keep this PR open any more?   The issues
seem to have been resolved, as much as they can be, right?


State-Changed-From-To: feedback->closed
State-Changed-By: kre@NetBSD.org
State-Changed-When: Sat, 18 Jun 2016 20:11:35 +0000
State-Changed-Why:
From: m33 <m33@tok715.net>
Date: Sat, 18 Jun 2016 18:36:37 +0200

You may close it, thanks.


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51216 CVS commit: [netbsd-7] src/lib/libutil
Date: Sun, 29 Jan 2017 05:17:34 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Sun Jan 29 05:17:33 UTC 2017

 Modified Files:
 	src/lib/libutil [netbsd-7]: opendisk.3 opendisk.c

 Log Message:
 Pull up following revision(s) (requested by pgoyette in ticket #1349):
 	lib/libutil/opendisk.c: revision 1.14
 	lib/libutil/opendisk.3: revision 1.12, 1.13
 PR/51216: Instead of trying to open files in the current working
 directory first for paths that don't contain "/", first try the
 /dev paths to avoid confusion with files in the working directory
 that happen to match disk names.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.11.42.1 src/lib/libutil/opendisk.3
 cvs rdiff -u -r1.12 -r1.12.24.1 src/lib/libutil/opendisk.c

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

>Unformatted:

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.