Subject: Having problems writing a disklabel to a virtual disk
To: None <netbsd-help@NetBSD.ORG>
From: Trevin Beattie <trevin@xmission.com>
List: netbsd-help
Date: 10/03/2001 14:03:26
Having installed NetBSD 1.5.2 on a virtual i386 machine, I thought I would
try to track down the problems of using a disk with alternate sector sizes
(in this case, 2048 bytes per sector).  I had no trouble creating the test
file and attaching it to a vnd device with the correct geometry.  However,
I am unable to create a disklabel or create a filesystem, and I'm not even
sure what is the correct form of the disklabel command I should be using.

The disk was created by:

# dd if=/dev/zero of=test-2kbps.vdsk bs=2048 count=1 seek=511
# vnconfig -c -v vnd0 test-2kbps.vdsk 2048/8/4/16

After consulting the disklabel(8) manpage (which isn't clear at all), I
tried the following forms of the command:

# disklabel -i -I -r vnd0
disklabel: can't read master boot record: Invalid argument
disklabel: /dev/rvnd0d: Input/output error
# disklabel -i -I vnd0
disklabel: can't read master boot record: Invalid argument
disklabel: /dev/rvnd0d: Input/output error
# disklabel -i -r vnd0
disklabel: can't read master boot record: Invalid argument
disklabel: /dev/rvnd0d: Input/output error
# disklabel -i vnd0
disklabel: can't read master boot record: Invalid argument
partition> 

At this point, even though I got an error, I had finally made it into the
interactive label editor.  So I tried writing out the kernel-supplied
default label:

partition> W
Label disk [n]? y
disklabel: warning, unused partition e: size 512 offset 0
disklabel: warning, unused partition f: size 512 offset 0
disklabel: warning, unused partition g: size 512 offset 0
disklabel: warning, unused partition h: size 512 offset 0
disklabel: warning, unused partition i: size 512 offset 0
disklabel: warning, unused partition j: size 512 offset 0
disklabel: warning, unused partition k: size 512 offset 0
disklabel: warning, unused partition l: size 512 offset 0
disklabel: warning, unused partition m: size 512 offset 0
disklabel: warning, unused partition n: size 512 offset 0
disklabel: warning, unused partition o: size 512 offset 0
disklabel: warning, unused partition p: size 512 offset 0
disklabel: ioctl DIOCWDINFO: Input/output error
Label not written

So I'm stuck; nothing worked.  Since the dummy disklabel looked good
enough, I tried just creating a filesystem with newfs.  But that didn't
work either:

# newfs -b 16384 -f 2048 -S 2048 /dev/rvnd0c
write error: 511
wtfs: Invalid argument

Thinking that all these problems might be due to lack of support for sector
sizes != 512, I tried reconfiguring the vnd device with 512 bytes per
sector.  Unfortunately, I still couldn't create a disklabel; all the
commands gave the same errors as above.  newfs also failed, but with a
different message:

# newfs -b 16384 -f 2048 -S 512 /dev/rvnd0a
/dev/rvnd0a:    2048 sectors in 16 cylinders of 4 tracks, 32 sectors
        1.0MB in 1 cyl groups (16 c/g, 1.00MB/g, 128 i/g)
super-block backups (for fsck -b #) at:write error: 96
wtfs: Input/output error

Does anybody have any clue as to what I might be doing wrong?  Is there an
easy way to create an initial disk label?  Is there a problem with the
disklabel or newfs programs, or with the vnd driver?

Help.

-----------------------
Trevin Beattie          "Do not meddle in the affairs of wizards,
trevin@xmission.com     for you are crunchy and good with ketchup."
      {:->                                     --unknown