Subject: Please close bin/4616 -- Disklabel insanity untouched since
To: None <tech-userlevel@netbsd.org>
From: Brian A. Seklecki <lavalamp@spiritual-machines.org>
List: tech-userlevel
Date: 10/10/2002 14:50:27
This one fell through the cracks. Simple fix, though.
http://mail-index.netbsd.org/netbsd-bugs/1997/12/01/0001.html
There's a very simple fix to this. Every once in a while the disklabel
will get blown away for whatever reason; corruption, dd(8)'ing /dev/zero
into the first few sectors of the disk after using in in a CCD or
RAIDFrame set, etc., etc.
when you disklabel the disk, disklabel(8) will print out a message like
so:
$ disklabel -e /dev/sd5
[fullscreen $EDITOR mode works fine]
disklabel: ioctl DIOCWDINFO: No disk label on disk;
use "disklabel -I" to install initial label
re-edit the label? [y]: n
However the cute recommendation to use -I is insuffcient
$ disklabel -I -e /dev/sd5
...will give you the same results, what you NEED is:
$ disklabel -I -r -e /dev/sd5
Or as described in the ticket:
zero# disklabel -i sd2
partition> W
Label disk [n]? y
disklabel: ioctl DIOCWDINFO: No disk label on disk;
use "disklabel -r" to install initial label
Label not written
partition> quit 4
The suggested fix:
disklabel should write the in-kernel version (psuedo, whatever)
disklabel to the drive even if it doesn't have a disklabel. This
causes the end-user to have to exit out of this wonderful utility
and defeats the -i usage. "W" implies that it will write this
label.. failing and telling the user to quite and run disklabel
again is just.. lame, since it's displaying the disklabel it's
supposed to write _anyway_!
This works, or a simple work-around would be to put a note in the
EXAMPLES section of the man page:
Line 386:
it appropriately (total size, partition offsets, types, etc.)
.Dl disklabel -I -r -e /dev/sd0
.Pp
Recover and restore in-kernel disklabel after possibile corruption.
.Sh DIAGNOSTICS