Re: junior-hacker task: "prepdisk"

1999-08-06 Thread Bruce Evans

>>>It differs in that you can boot from the disk afterwards with my script,
>>>you cant with disklabel -w wd0 auto.
>
>>That may be because you forgot to supply the -r or -B args to disklabel,
>>[...]
>
>No it is because the fool BIOS belives the 5 in the MBR.

This problem can be avoided by using fdisk to install a proper MBR
before running disklabel.  disklabel will then avoid writing to the MBR.
fdisk even has reasonable defaults, but not what you want.  Its default
seems to be to create a proper MBR with slice 4 starting at sector 1
(0-based) and having size (size of disk rounded down to a fdisk's idea
of a cylinder boundary) - 1.  You want start 0 and size (size of disk).
Of course, BIOSes could reasonably consider this partition as garbage
since it overlaps the MBR.  Similarly for partitions with start 1,
since they overlap the first track.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-05 Thread Poul-Henning Kamp

In message <[EMAIL PROTECTED]>, Bruce Evans writes:
>>>: It seems that our new boot blocks doesn't like the taste of disks
>>>: prepared according to the meagre information we have in the handbook.
>>>
>>>How does this script differ from 'disklabel -w wd0 auto'?  It does do
>>>the fdisk stuff (your script, not the disklabel command).
>>
>>It differs in that you can boot from the disk afterwards with my script,
>>you cant with disklabel -w wd0 auto.
>


>That may be because you forgot to supply the -r or -B args to disklabel,
>[...]

No it is because the fool BIOS belives the 5 in the MBR.

--
Poul-Henning Kamp FreeBSD coreteam member
[EMAIL PROTECTED]   "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-05 Thread Bruce Evans

>>: It seems that our new boot blocks doesn't like the taste of disks
>>: prepared according to the meagre information we have in the handbook.
>>
>>How does this script differ from 'disklabel -w wd0 auto'?  It does do
>>the fdisk stuff (your script, not the disklabel command).
>
>It differs in that you can boot from the disk afterwards with my script,
>you cant with disklabel -w wd0 auto.

That may be because you forgot to supply the -r or -B args to disklabel,
or forgot to edit the label using disklabel -e.  I think no editing is
required to boot from the 'c' partition (the missing d_type initialisation
doesn't matter because the `d_type != DTYPE_SCSI' case defaults to
DTYPE_ESDI (aka IDE)).  The 'a' partition produced by
`disklabel -Brw wd0 auto ' is obviosuly unbootable and unnewfsable,
etc., since it is empty.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-05 Thread Poul-Henning Kamp

In message <[EMAIL PROTECTED]>, Warner Losh writes:
>In message <[EMAIL PROTECTED]> Poul-Henning Kamp writes:
>: It seems that our new boot blocks doesn't like the taste of disks
>: prepared according to the meagre information we have in the handbook.
>
>How does this script differ from 'disklabel -w wd0 auto'?  It does do
>the fdisk stuff (your script, not the disklabel command).

It differs in that you can boot from the disk afterwards with my script,
you cant with disklabel -w wd0 auto.

--
Poul-Henning Kamp FreeBSD coreteam member
[EMAIL PROTECTED]   "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-05 Thread Warner Losh

In message <[EMAIL PROTECTED]> Poul-Henning Kamp writes:
: It seems that our new boot blocks doesn't like the taste of disks
: prepared according to the meagre information we have in the handbook.

How does this script differ from 'disklabel -w wd0 auto'?  It does do
the fdisk stuff (your script, not the disklabel command).

Warner


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-02 Thread Warner Losh

In message <[EMAIL PROTECTED]> Poul-Henning Kamp writes:
: My real beef here is not with the boot failure but with the fact that our
: command line tools stink when I bring in a new blank disk...

Yes.  Several times I've hit this problem, but have never been PO'd
enough to fix it...

Warner


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-02 Thread Bruce Evans

>> very dangerously dedicated:= dangerously dedicated with the DOSpartition
>> table and/or boot signature zeroed or otherwise clobbered.
>> undangerously dedicated:= dangerously dedicated with the DOSpartition table
>> fixed to cover the whole disk (including the MBR).  This is very easy
>> to generate without sysinstall (just enter the start (0) and size for
>> one partition in fdisk(8)).

>I've been looking for that tidbit forever!  If you can build up a sample
>session, I'll docify it pronto.  I don't have a disk to clobber or else
>I'd be writing docs right now :)

Make one using vnconfig(8) :-).

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-02 Thread Doug White

On Tue, 3 Aug 1999, Bruce Evans wrote:

> >>> My semantics may be wrong on these two: what I'm talking about is
> >>> what is in handbook chapter 8 "Using command line utilities " gives
> >>> you a disk which doesn't boot.
> >>
> >>Ok; of those two examples, the first should give you a truly dedicated 
> >>disk.  (You can only generate a "dangerously dedicated" disk with 
> >>sysinstall.)
> 
> The first gives a vanilla dangerously dedicated disk (one with a historical
> bogus DOSpartition table of size 5).  Terminology for variants is less
> standard, e.g.:
> 
> very dangerously dedicated:= dangerously dedicated with the DOSpartition
> table and/or boot signature zeroed or otherwise clobbered.
> undangerously dedicated:= dangerously dedicated with the DOSpartition table
> fixed to cover the whole disk (including the MBR).  This is very easy
> to generate without sysinstall (just enter the start (0) and size for
> one partition in fdisk(8)).

I've been looking for that tidbit forever!  If you can build up a sample
session, I'll docify it pronto.  I don't have a disk to clobber or else
I'd be writing docs right now :)

Doug White   
Internet:  [EMAIL PROTECTED]| FreeBSD: The Power to Serve
http://gladstone.uoregon.edu/~dwhite| www.freebsd.org



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-02 Thread Doug White

On Mon, 2 Aug 1999, Poul-Henning Kamp wrote:

> In message <[EMAIL PROTECTED]>, Mike Smith writes:
> >> In message <[EMAIL PROTECTED]>, Bruce Evans writes:
> >> 
> >> >All of the above only work for the easy case where the whole disk is
> >> >being labelled.  In general, the disk size must be reduced to the slice
> >> >size before applying a label to a slice.
> >> 
> >> And that is the problem, it seems that "dangerously dedicated" doesn't 
> >> boot anymore...
> >
> >It never did, on many hardware variants.  Use "truly dedicated" 
> >instead, which should still work fine.
> 
> My semantics may be wrong on these two: what I'm talking about is
> what is in handbook chapter 8 "Using command line utilities " gives
> you a disk which doesn't boot.

What BIOS do you have?

Did you try the tutorial version? 

I know machines that won't boot disks missing MS partition tables.

Doug White   
Internet:  [EMAIL PROTECTED]| FreeBSD: The Power to Serve
http://gladstone.uoregon.edu/~dwhite| www.freebsd.org



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-02 Thread Bruce Evans

>>> My semantics may be wrong on these two: what I'm talking about is
>>> what is in handbook chapter 8 "Using command line utilities " gives
>>> you a disk which doesn't boot.
>>
>>Ok; of those two examples, the first should give you a truly dedicated 
>>disk.  (You can only generate a "dangerously dedicated" disk with 
>>sysinstall.)

The first gives a vanilla dangerously dedicated disk (one with a historical
bogus DOSpartition table of size 5).  Terminology for variants is less
standard, e.g.:

very dangerously dedicated:= dangerously dedicated with the DOSpartition
table and/or boot signature zeroed or otherwise clobbered.
undangerously dedicated:= dangerously dedicated with the DOSpartition table
fixed to cover the whole disk (including the MBR).  This is very easy
to generate without sysinstall (just enter the start (0) and size for
one partition in fdisk(8)).

The second example is equivalent to the first except for bugs.  Adding a
`disklabel -e' step would fix it but then it would be too equivalent to
be useful.  The point of it is that the editing step can be inserted in
the pipeline.  This is necessary to handle all cases except dedicated
ones.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-02 Thread Poul-Henning Kamp

In message <[EMAIL PROTECTED]>, Robert Nordier writes:
>> >What fails?  Can you be more specific?  How recent are your boot1/boot2 
>> >blocks?  I would be inclined to dd at least 8k over the front of the 
>> >disk myself, but I don't think that's relevant in your case.
>> 
>> Disk error #1 while trying to load boot/loader.  I think the bios
>> in this case trust the 5 in the length field of the mbr.
>
>Any better luck after enabling "LBA access" in boot1 as a build
>option (added back a few weeks ago), or does the BIOS not support
>this?
>
>BTW: Is this a genuine hard drive, or some form of disk-on-a-chip?
>I seem to recall the BIOS geometry in some cases uses a small number
>of sectors per track, which may push part of the 'a' partition
>beyond the 1023 CHS limit.

I've seen this on both flash disks and real disks.  The flash disks
have geometries which put them firmly inside 1023 cyls:

fla0 maddr 0xd msize 8192 on isa
fla0: 
fla0: 39.1MB (80144 sectors), 1001 cyls, 16 heads, 5 S/T, 512 B/S
fla1 maddr 0xd2000 msize 8192 on isa
fla1: 
fla1: 70.5MB (144320 sectors), 1002 cyls, 16 heads, 9 S/T, 512 B/S
fla2 maddr 0xd4000 msize 8192 on isa
fla2: 
fla2: 39.1MB (80144 sectors), 1001 cyls, 16 heads, 5 S/T, 512 B/S
fla3 maddr 0xd6000 msize 8192 on isa
fla3: 
fla3: 141.0MB (288832 sectors), 1002 cyls, 16 heads, 18 S/T, 512 B/S
fla4 maddr 0xd8000 msize 8192 on isa
fla4: 
fla4: 7.8MB (15920 sectors), 995 cyls, 16 heads, 1 S/T, 512 B/S

So cyl 1024 should not even enter in the equation...

My real beef here is not with the boot failure but with the fact that our
command line tools stink when I bring in a new blank disk...

--
Poul-Henning Kamp FreeBSD coreteam member
[EMAIL PROTECTED]   "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-02 Thread Robert Nordier

> >What fails?  Can you be more specific?  How recent are your boot1/boot2 
> >blocks?  I would be inclined to dd at least 8k over the front of the 
> >disk myself, but I don't think that's relevant in your case.
> 
> Disk error #1 while trying to load boot/loader.  I think the bios
> in this case trust the 5 in the length field of the mbr.

Any better luck after enabling "LBA access" in boot1 as a build
option (added back a few weeks ago), or does the BIOS not support
this?

BTW: Is this a genuine hard drive, or some form of disk-on-a-chip?
I seem to recall the BIOS geometry in some cases uses a small number
of sectors per track, which may push part of the 'a' partition
beyond the 1023 CHS limit.

Anyway, if some debugging code would help here, let me know.

--
Robert Nordier


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-01 Thread Poul-Henning Kamp

In message <[EMAIL PROTECTED]>, Mike Smith writes:

>> My semantics may be wrong on these two: what I'm talking about is
>> what is in handbook chapter 8 "Using command line utilities " gives
>> you a disk which doesn't boot.
>
>Ok; of those two examples, the first should give you a truly dedicated 
>disk.  (You can only generate a "dangerously dedicated" disk with 
>sysinstall.)
>
>What fails?  Can you be more specific?  How recent are your boot1/boot2 
>blocks?  I would be inclined to dd at least 8k over the front of the 
>disk myself, but I don't think that's relevant in your case.

Disk error #1 while trying to load boot/loader.  I think the bios
in this case trust the 5 in the length field of the mbr.

We really need commandline tools that can do this...  And without too
much magic please...

--
Poul-Henning Kamp FreeBSD coreteam member
[EMAIL PROTECTED]   "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-01 Thread Mike Smith

> In message <[EMAIL PROTECTED]>, Mike Smith writes:
> >> In message <[EMAIL PROTECTED]>, Bruce Evans writes:
> >> 
> >> >All of the above only work for the easy case where the whole disk is
> >> >being labelled.  In general, the disk size must be reduced to the slice
> >> >size before applying a label to a slice.
> >> 
> >> And that is the problem, it seems that "dangerously dedicated" doesn't 
> >> boot anymore...
> >
> >It never did, on many hardware variants.  Use "truly dedicated" 
> >instead, which should still work fine.
> 
> My semantics may be wrong on these two: what I'm talking about is
> what is in handbook chapter 8 "Using command line utilities " gives
> you a disk which doesn't boot.

Ok; of those two examples, the first should give you a truly dedicated 
disk.  (You can only generate a "dangerously dedicated" disk with 
sysinstall.)

What fails?  Can you be more specific?  How recent are your boot1/boot2 
blocks?  I would be inclined to dd at least 8k over the front of the 
disk myself, but I don't think that's relevant in your case.

-- 
\\  The mind's the standard   \\  Mike Smith
\\  of the man.   \\  [EMAIL PROTECTED]
\\-- Joseph Merrick   \\  [EMAIL PROTECTED]




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-01 Thread Poul-Henning Kamp

In message <[EMAIL PROTECTED]>, Mike Smith writes:
>> In message <[EMAIL PROTECTED]>, Bruce Evans writes:
>> 
>> >All of the above only work for the easy case where the whole disk is
>> >being labelled.  In general, the disk size must be reduced to the slice
>> >size before applying a label to a slice.
>> 
>> And that is the problem, it seems that "dangerously dedicated" doesn't 
>> boot anymore...
>
>It never did, on many hardware variants.  Use "truly dedicated" 
>instead, which should still work fine.

My semantics may be wrong on these two: what I'm talking about is
what is in handbook chapter 8 "Using command line utilities " gives
you a disk which doesn't boot.


--
Poul-Henning Kamp FreeBSD coreteam member
[EMAIL PROTECTED]   "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-01 Thread Mike Smith

> In message <[EMAIL PROTECTED]>, Bruce Evans writes:
> 
> >All of the above only work for the easy case where the whole disk is
> >being labelled.  In general, the disk size must be reduced to the slice
> >size before applying a label to a slice.
> 
> And that is the problem, it seems that "dangerously dedicated" doesn't 
> boot anymore...

It never did, on many hardware variants.  Use "truly dedicated" 
instead, which should still work fine.

-- 
\\  The mind's the standard   \\  Mike Smith
\\  of the man.   \\  [EMAIL PROTECTED]
\\-- Joseph Merrick   \\  [EMAIL PROTECTED]




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-01 Thread Poul-Henning Kamp

In message <[EMAIL PROTECTED]>, Bruce Evans writes:

>All of the above only work for the easy case where the whole disk is
>being labelled.  In general, the disk size must be reduced to the slice
>size before applying a label to a slice.

And that is the problem, it seems that "dangerously dedicated" doesn't 
boot anymore...

--
Poul-Henning Kamp FreeBSD coreteam member
[EMAIL PROTECTED]   "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-01 Thread Bruce Evans

>It seems that our new boot blocks doesn't like the taste of disks
>prepared according to the meagre information we have in the handbook.
>
>The following script seems to DTRT for me, and should really be
>either integrated into a "fdisk -A" flag or maybe as a stand alone
>script.  Either way: manpage & handbook needs updated too.
>...
>#!/bin/sh
>
>dev=fla0
>
>grep "$dev.*sectors" /var/run/dmesg | tr -d '(:)' | awk '
>   {
>   v = $3
>   c = $5
>   h = $7
>   s = $9
>   ss = c * h * s - s
>
>   print "#",$0 > "_"
>   print "g c"c" h"h" s"s > "_"
>   print "p 1 165",s,ss > "_"
>   print "a 1" > "_"
>
>   print "#",$0  > "__"
>   print "type: ESDI" > "__"
>   print "disk:", $1 > "__"
>   print "label:" > "__"
>   print "flags:" > "__"
>   print "bytes/sector: 512" > "__"
>   print "sectors/track:", s > "__"
>   print "tracks/cylinder:", h > "__"
>   print "sectors/cylinder:", s * h > "__"
>   print "cylinders:", c > "__"
>   print "sectors/unit:", ss > "__"
>   print "rpm: 3600" > "__"
>   print "interleave: 1" > "__"
>   print "trackskew: 0" > "__"
>   print "cylinderskew: 0" > "__"
>   print "headswitch: 0   # milliseconds" > "__"
>   print "track-to-track seek: 0  # milliseconds" > "__"
>   print "drivedata: 0 " > "__"
>   print "8 partitions:" > "__"
>   print "#size   offsetfstype   [fsize bsize bps/cpg]" > "__"
>   print "a:",ss,"0 4.2BSD 512 4096 " > "__"
>   print "c:",ss,"0 unused 0 0" > "__"
>   }
>' 
>fdisk -f _ -i -v $dev
>disklabel -BrR ${dev} __
>newfs /dev/r${dev}a

This fails for SCSI disks, since the "sectors" line is formatted differently.
The disklabel parts of it are mostly a bad way to write:

disklabel -BrR ${dev} auto
disklabel -e ${dev}
# Editing steps in above disklabel -e:
# (1) Change "type" to ESDI if it is an ESDI disk.  It is a bug that
# the wd driver doesn't set label.d_type = DTYPE_ESDI.  The da
# driver doesn't have this problem.
# (2) Add "a:" and any other desired/required partitions.  It is a
# bug if the bootstrap can't find boot2 in the 'c' partition
# where it has just been written.

or

disklabel /dev/r${dev} | sed ... | disklabel -BrR ${dev} /dev/stdin
# Editing steps in the sed command are as above.

All of the above only work for the easy case where the whole disk is
being labelled.  In general, the disk size must be reduced to the slice
size before applying a label to a slice.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-01 Thread Poul-Henning Kamp

In message <[EMAIL PROTECTED]>, Nik Clayton writes:
>On Sun, Aug 01, 1999 at 04:19:52PM +0200, Poul-Henning Kamp wrote:
>> The following script seems to DTRT for me, and should really be
>> either integrated into a "fdisk -A" flag or maybe as a stand alone
>> script.  Either way: manpage & handbook needs updated too.
>
>What, specifically, is wrong with them?

Well, the suggested example in the handbook doesn't work for a boot disk,
and if options or commands are added a manpage should be too :-)

--
Poul-Henning Kamp FreeBSD coreteam member
[EMAIL PROTECTED]   "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: junior-hacker task: "prepdisk"

1999-08-01 Thread Nik Clayton

On Sun, Aug 01, 1999 at 04:19:52PM +0200, Poul-Henning Kamp wrote:
> The following script seems to DTRT for me, and should really be
> either integrated into a "fdisk -A" flag or maybe as a stand alone
> script.  Either way: manpage & handbook needs updated too.

What, specifically, is wrong with them?

N
-- 
 [intentional self-reference] can be easily accommodated using a blessed,
 non-self-referential dummy head-node whose own object destructor severs
 the links.
-- Tom Christiansen in <[EMAIL PROTECTED]>


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message