Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Mar 2000 01:05:31 PST
From:      Marc Frajola <marc@enginet.com>
To:        Doug White <dwhite@resnet.uoregon.edu>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: How to fdisk/disklabel whole disk for FreeBSD from command line? 
Message-ID:  <200003010905.BAA16360@enginet.com>
In-Reply-To: Your message of "Tue, 29 Feb 2000 22:16:27 PST." <Pine.BSF.4.21.0002292213410.62060-100000@resnet.uoregon.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 29 Feb 2000, Doug White wrote:
> On Mon, 28 Feb 2000, Marc Frajola wrote:
> 
> >     Thanks very much for the reply. I checked out the URL you gave
> > (http://www.freebsd.org/tutorials/formatting-media/), and unfortunately
> > I'm still wondering how to create one FreeBSD fdisk slice so that
> > disklabel can actually create partitions.
> > 
> >     The reason why I sent the message to freebsd-hackers was because
> > when I tried 'fdisk -e', it seems to assign a slice, BUT disklabel
> > gives an error like 'No space left on device' or some such thing after
> > running fdisk, making it obvious that the fdisk -e didn't work as I
> > thought it should.
> 
> What are you using for your command lines?  You have to target the
> disklabel specifically at slice 1 on the disk otherwise disklabel will
> think you're trying to overwrite the slice table and get mad.

    Here's what I did:

	fdisk -e /dev/rda1
	disklabel -r -w da1 auto

    The disklabel command gives 'disklabel: No space left on device'.

> >     I will check out the 'install' PicoBSD floppy here shortly to
> > see if I can learn anything from that.
> 
> I just did that twice today and it definitely works :)  The only problem I
> had with those is that the disk boot order (this is a L440GX+ board where
> you can configure it) was screwy (i.e. primary-master wasn't the preferred
> boot disk).

> >     If anybody knows right off what the sequence of commands (complete
> > with arguments) to fdisk and disklabel a new drive to make a
> > "compatiblity mode" bootable FreeBSD system slice (and make it active),
> > I'd appreciate hearing from you.
> 
> I have an awk script mercilessly stolen from phk that does the disklabel
> dirty work.  Otherwise it's straightforward:
> 
> fdisk -e wd0
> disklabel .. magic .. 
> newfs /dev/wd0s1a

    OK, may I ask what the ".. magic .." part is??

    I am using SCSI drives (hence da). I tried doing 'camcontrol rescan
da1' as suggested by somebody on the mailing list, and that had no
effect on the problem.

    When I use 'sysinstall', I can write an fdisk slice label and a
FreeBSD disk label properly, and all is well. I just can't automate it.

    I glanced through the source code for disklabel and sysinstall. It
looks like sysinstall uses libdisk to write the label. The command-line
'disklabel' utility appears to use an ioctl to set the disklabel, and
the DIOCSDINFO call returns the error. My theory is that sysinstall
works because it does NOT go through the standard kernel interface (at
least if it does, I can't find the DIOCSDINFO call).

    The reason the kernel returns the error appears to be because it
thinks one of the sizes given in the new label exceeds the size of the
fdisk slice.

    Even if I try using 'disklabel -e da1' to edit the label, I still
get errors like 'disklabel: ioctl DIOCGDINFO: Invalid argument', so it
may not be something wrong with just the 'auto' mode on disklabel.

    Anyway, I'm still very open to hints after spending several hours
trying to figure this out.

    I noticed that 'fdisk -e /dev/rda1' seems to get the ending
cylinder number completely wrong, but even if I run fdisk entering what
I think are the proper numbers manually, disklabel still does not seem
to be happy.

    As per your suggestion, I tried 'disklabel -r -w da1s1 auto', and
I get the following errors:

	disklabel: ioctl DIOCGDINFO: Invalid argument
	disklabel: auto: unknown disk type

    So I'm doubt that disklabel really wants me to target slice 1
directly.

    BTW, I'm using an Intel Xeon motherboard (SC450NX) with an Adaptec
2940U2W controller hooked up to a SCSI-to-SCSI RAID controller, and am
trying to do the fdisk/disklabel on the RAID drive. The BIOS reports
that the drive is slightly larger than what fdisk actually assigns to
the partition (in # of sectors -- I actually expected this slight
difference in size).

    I really appreciate all the hints so far even though no solution
yet...

...Marc...

P.S.: If somebody who has PicoBSD source available could send me any
      relevant scripts or source excerpts from it that deal with fdisk
      or disklabel, it would be greatly appreciated.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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