NetBSD Problem Report #44286

From  Tue Dec 28 09:44:32 2010
Return-Path: <>
Received: from ( [])
	by (Postfix) with ESMTP id DFC6B63B89F
	for <>; Tue, 28 Dec 2010 09:44:31 +0000 (UTC)
Message-Id: <>
Date: Tue, 28 Dec 2010 09:44:31 +0000 (UTC)
Subject: Partition size not correctly recognised in lvm / pvcreate
X-Send-Pr-Version: www-1.0

>Number:         44286
>Category:       bin
>Synopsis:       Partition size not correctly recognised in lvm / pvcreate
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 28 09:45:00 +0000 2010
>Originator:     Martin Mersberger
>Release:        NetBSD-current
NetBSD melon 5.99.41 NetBSD 5.99.41 (GENERIC-PF) #0: Sun Dec 26 23:47:17 UTC 2010  root@melon:/usr/obj/sys/arch/sparc64/compile/GENERIC-PF sparc64

When I try to create a LVM physical volume on a raid1 raidframe set, it seems, that DIOCGDINFO is used to determine the size of the wedge.

Looking at the code, dev-io.c, *size /= lab.d_secsize (sector size via disklabel..) - but *size is not set beforehand (ie. when get_dev_size is invoked in filter.c). I guess, that's not correctly implemented at the moment...

ie. a pvcreate (Don't worry about the output dev-io.c:289 - that's some debug I added locally - but at this lines +-10, the error occurs)

melon# lvm pvcreate /dev/rraid0f -vvvv
#/usr/src/external/gpl2/lvm2/dist/tools/lvmcmdline.c:1002         Processing: pvcreate /dev/rraid0f -vvvv
#/usr/src/external/gpl2/lvm2/dist/tools/lvmcmdline.c:1005         O_DIRECT will be used
#/usr/src/external/gpl2/lvm2/dist/lib/config/config.c:992       global/locking_type not found in config: defaulting to 1
#/usr/src/external/gpl2/lvm2/dist/lib/config/config.c:992       global/wait_for_locks not found in config: defaulting to 1
#/usr/src/external/gpl2/lvm2/dist/lib/locking/locking.c:242       File-based locking selected.
#/usr/src/external/gpl2/lvm2/dist/lib/config/config.c:970       global/locking_dir not found in config: defaulting to /var/lock/lvm
#/usr/src/external/gpl2/lvm2/dist/lib/config/config.c:992       metadata/pvmetadatasize not found in config: defaulting to 255
#/usr/src/external/gpl2/lvm2/dist/lib/config/config.c:992       metadata/pvmetadatacopies not found in config: defaulting to 1
#/usr/src/external/gpl2/lvm2/dist/lib/locking/file_locking.c:237       Locking /var/lock/lvm/P_orphans WB
#/usr/src/external/gpl2/lvm2/dist/lib/locking/file_locking.c:143         _do_flock /var/lock/lvm/P_orphans:aux WB
#/usr/src/external/gpl2/lvm2/dist/lib/locking/file_locking.c:143         _do_flock /var/lock/lvm/P_orphans WB
#/usr/src/external/gpl2/lvm2/dist/lib/locking/file_locking.c:53         _undo_flock /var/lock/lvm/P_orphans:aux
#/usr/src/external/gpl2/lvm2/dist/lib/device/dev-io.c:539         Opened /dev/rraid0f RW O_DIRECT
#/usr/src/external/gpl2/lvm2/dist/lib/device/dev-io.c:159         /dev/rraid0f: block size is 512 bytes
#/usr/src/external/gpl2/lvm2/dist/lib/label/label.c:186       /dev/rraid0f: No label detected
#/usr/src/external/gpl2/lvm2/dist/lib/device/dev-io.c:585         Closed /dev/rraid0f
#/usr/src/external/gpl2/lvm2/dist/lib/device/dev-io.c:539         Opened /dev/rraid0f RW O_EXCL O_DIRECT
#/usr/src/external/gpl2/lvm2/dist/lib/device/dev-io.c:585         Closed /dev/rraid0f
#/usr/src/external/gpl2/lvm2/dist/lib/device/dev-io.c:289         Size via DIOCGDINFO initial size is 0
#/usr/src/external/gpl2/lvm2/dist/lib/device/dev-io.c:309       /dev/rraid0f: size is 0 sectors
#/usr/src/external/gpl2/lvm2/dist/lib/metadata/metadata.c:1535   /dev/rraid0f: Size must exceed minimum of 1024 sectors.
#/usr/src/external/gpl2/lvm2/dist/lib/metadata/metadata.c:1393   Failed to setup physical volume "/dev/rraid0f"
#/usr/src/external/gpl2/lvm2/dist/tools/pvcreate.c:105         <backtrace>
#/usr/src/external/gpl2/lvm2/dist/lib/locking/file_locking.c:76       Unlocking /var/lock/lvm/P_orphans
#/usr/src/external/gpl2/lvm2/dist/lib/locking/file_locking.c:53         _undo_flock /var/lock/lvm/P_orphans

Try to create a physical volume on a device, which does not support DIOCGWEDGEINFO ioctls. (same effect for example, if you are using a vnd...)
partutil.c does contain some code (getdiskinfo), where partition sizes are calculated via struct disklabel and partition.

IMHO, that code would give better results. 
Anonother option might be, to utilize partutil.c directly in dev-io.c at let partutil do the work.

NetBSD Home
NetBSD PR Database Search

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