Subject: kern/2759: vnd doesn't support disklabel ioctls
To: None <gnats-bugs@gnats.netbsd.org>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: netbsd-bugs
Date: 09/16/1996 00:49:52
>Number:         2759
>Category:       kern
>Synopsis:       vnd doesn't support disklabel ioctls
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 16 01:05:01 1996
>Last-Modified:
>Originator:     Jonathan Stone
>Organization:
	NetBSD
>Release:        1.2_BETA
>Environment:
	
System: NetBSD Cup.DSG.Stanford.EDU 1.2_BETA NetBSD 1.2_BETA (DSG) #47: Mon Jul 29 12:05:57 PDT 1996 jonathan@Cup.DSG.Stanford.EDU:/aga/n1/src/NetBSD/IP-PLUS/src/sys/arch/i386/compile/DSG i386


>Description:

vnconfig doesn't support the disklabel ioctl suite.
This makes it difficult to use vnd to build distirbution miniroots.
I dont' see any good way to get a disklabel onto a file.


>How-To-Repeat:

Use vnconfig to configure a local file as a pmax disk image.  (e.g.,
something larger than a floppy).  Use that disk image (e.g.,
/dev/vnd0c) to build a distribution miniroot.

Ship the miniroot to users. Receive complaints that the miniroot
contains neither label nor bootblock.


I'm using vnd because I don't have a spare disk  on which to build
a miniroot, if i did I'd use that to write a label.

Even if I fake up a label on another device, I don't see any good way
(e.g., dd) to overwrite the first 8k of an FFS image once I've built
it.  I've tried using dd, but it truncates the output after  it's done


>Fix:

It would be useful if the  vnconfig and/or vnd man pages at least
mentioned this restriction/bug, and suggested a workaround.


In private e-mail, Jason Thorpe has suggested that the crrect to fix
this is to make the vnd driver support the disklabel ioctl set,
writing a label to the appropriat portion of the file underyling the
vnd "device".

Perhaps a workable workaround is to construct the filesystem image
used as vnd backing store *first*, using dd to read out a valid
bootblock and disklabel from a labelled partition, padding from 8k up
to the desired miniroot size, and *then* doing vnconfig.

>Audit-Trail:
>Unformatted: