Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 1996 18:07:00 +0200 (MET DST)
From:      grog@lemis.de (Greg Lehey)
To:        hackers@freebsd.org (FreeBSD Hackers)
Subject:   New disks on 2.1-RELEASE: help
Message-ID:  <199605021607.SAA11265@allegro.lemis.de>

next in thread | raw e-mail | index | archive | help
I'm currently in the process of writing up how to set up a second hard
disk on 2.1 RELEASE.  This has been slightly hampered by 2 problems:

1.  I currently don't have a disk with 2.1 RELEASE, and I don't have
    time to rebuild things to install it (there's a whole lot of work
    backed up there).

2.  There's a bug in -current disklabel, probably as the result of a
    kernel change.  I'll get back to that in a minute.

So: my question.  Would some kind soul please try this with a SCSI
disk they don't mind overwriting.  Please stick very closely to the
sequence (or tell me why it's broken :-), since that's what I'm going
to write.  Obviously the disk doesn't have to be sd1.

1.  Format:

    scsiformat sd1

2.  fdisk -u sd1

    Put at least 2 partitions in.

3.  disklabel -w -r sd1 <tag>

<tag> is a tag in /etc/disktab.  If you don't have one for your disk,
and you don't know how to make one, but you're prepared to let the
rest of the ordeal pass over you, contact me and I'll send you my
writeup tomorrow.  It's currently too flaky to send.

Back to the problem:  disklabel issues an ioctl (DIOCSDINFO) against
the raw disk, and then checks the return value.  disklabel.c:408:

		if (ioctl(f, DIOCSDINFO, lp) < 0 &&
		    errno != ENODEV && errno != ENOTTY) {
			l_perror("ioctl DIOCSDINFO");
			return (1);
		}

In the -current kernel, this ioctl returns an EINVAL when issued
against a disk with an invalid label.  I changed this to:

		if (ioctl(f, DIOCSDINFO, lp) < 0 &&
		    errno != ENODEV && errno != ENOTTY && errno != EINVAL) {
			l_perror("ioctl DIOCSDINFO");
			return (1);
		}

and things now work.  That doesn't help the users of 2.1, of course,
and I'd rather like this to be correct. 

Greg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605021607.SAA11265>