Re: Dangerously dedicated vs. fully dedicated, etc.

2004-09-24 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Ian Dowse <[EMAIL PROTECTED]> typed:
> In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes:
> >Mike, I'll pay back your effort in replying to this long thing by
> >working up a patch for the "disklabel" manpage (at least) and, if you
> >want, I'll CC you so you can veto things you don't like.  I do worry
> (B) Dedicated format created by sysinstall
> 
>   
>   
>   sector 0: boot1 and the DOS slice table, where
>   the slice table contains one slice
>   (slice 1) covering the entire disk,
>   including sector 0.
>   sector 1:   disklabel
>   sector 2-15:boot2
>   sectors 16-31:  'a' partition filesystem superblock
> 
>  In this case, there is no boot0, and boot1 serves as the boot
>  loader that is invoked by the BIOS. Here, all of the boot code
>  is contained within the first slice and also within the first
>  partition. Again, the 8k reserved at the start of every ffs
>  filesystem protects the boot code. Sysinstall sets up fstab to
>  refer to the partitions as e.g. /dev/ad0s1a (I think).

This can also be referred to as /dev/ad0a, like your C case. I
personally prefer that because it lets you know that the disk is DD.

  http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Dangerously dedicated vs. fully dedicated, etc.

2004-09-24 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Ian Dowse <[EMAIL PROTECTED]> typed:
> As to the issue of BIOSes disliking DD modes, there have been a few
> different reasons suggested.

I had a dual xeon BIOS that had "anti-virus" code. If the boot block
didn't have the write MBR on it, it rewrote the first 63 sectors,
clobbering my DD (type B) disklabel. It could be turned off in the
BIOS, but caused me (not the kernel) to panic the first time it
happened.

  http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Dangerously dedicated vs. fully dedicated, etc.

2003-01-15 Thread Gary W. Swearingen
Mike Meyer <[EMAIL PROTECTED]> writes:

> As you can see, it's sector 1, not sector 0. Everything else seems to
> be correct.

More terminology problems.  "1" means "0".  Says "fdisk":

Warning: BIOS sector numbering starts with sector 1

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



Re: Dangerously dedicated vs. fully dedicated, etc.

2003-01-15 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Gary W. Swearingen <[EMAIL PROTECTED]> typed:
> Ian Dowse <[EMAIL PROTECTED]> writes:
> You've cleared up several things, thanks. (I still don't see why any
> BIOS would have trouble with a DD disk, leading to DD's deprecation, but
> I can just take people's word for it, for the task at hand.)  BTW, I've
> seen both of your options referred to as DD, if I understood it right.

There are BIOSes out there that check sector 0, and fail to recognize
the disk if it if the MBR doesn't conform to their idea of
"valid". Some of them will overwite sector 0 with a "valid" MBR in
that case. I've had this happen to me, meaning my disk was fried every
time I rebooted the system - until I turned off the "Virus protection"
feature of the BIOS.

> > (C) Dedicated format using dummy slice
> ...
> One such as would be created by "disklabel -B".  (/boot/boot1 seems to
> have the fourth slice pre-defined.)  This differs from "B" only in the
> slice table, right?  The "disklabel" manpage implies that this is a DD.

Yes, the slice table is the only difference. This is what you get if
you install a "dangerously dedicated" disk with the i386 installer. In
fact, I've got one here:

Information from DOS bootblock is:
The data for partition 1 is:
sysid 165,(FreeBSD/NetBSD/386BSD)
start 0, size 17942584 (8761 Meg), flag 80 (active)
beg: cyl 0/ head 0/ sector 1;
end: cyl 1023/ head 17/ sector 4
The data for partition 2 is:

The data for partition 3 is:

The data for partition 4 is:



> It seems that a DD disk is one which is similar to a single slice
> starting at sector 0, regardless of what the slice table part of sector
> 0 contains.  With FreeBSD-standard boot code and some BIOSes, one disk
> layout (ie, DD or sliced) will work better than the other.  (And for DD
> disks, some slice table contents might work better than others.  I've
> not read anything comparing your "B" and "C" or either with a slice
> table full of zeros or random bits.)

As you can see, it's sector 1, not sector 0. Everything else seems to
be correct.

  http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

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



Re: Dangerously dedicated vs. fully dedicated, etc.

2003-01-15 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Gary W. Swearingen <[EMAIL PROTECTED]> typed:
> Mike, I'll pay back your effort in replying to this long thing by
> working up a patch for the "disklabel" manpage (at least) and, if you
> want, I'll CC you so you can veto things you don't like.  I do worry
> about how so few people comment on manpage changes before they go in,
> but they need improvement so badly it's worth the risk of a few errors.
> If you can't reply or even read it, that's OK too; I think I learned
> something in the writing of it.

I'd be more than happy to review any changes you make. And I'm happy
to see you turning things into something more substantial than an
archived message.

  http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

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



Re: Dangerously dedicated vs. fully dedicated, etc.

2003-01-14 Thread Ian Dowse
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes:
>/boot/boot0 has the FreeBSD bootloader.  The installer also offers
>to use the "standard" /boot/mbr.

>Roughly speaking.  /boot/boot2 is 15 sectors; I suppose the first
>(all zeros) is replaced with the disklabel, loosely speaking.

>One such as would be created by "disklabel -B".  (/boot/boot1 seems to
>have the fourth slice pre-defined.)  This differs from "B" only in the
>slice table, right?  The "disklabel" manpage implies that this is a DD.

Exactly. Thanks for filling in the details I missed. The other magic
thing about the bogus 5-sector slice is that the kernel detects
this special case and then completely ignores the slice table and
makes the compatibility slice cover the whole disk (I'm not 100%
sure of the details here).

>It seems that a DD disk is one which is similar to a single slice
>starting at sector 0, regardless of what the slice table part of sector
>0 contains.  With FreeBSD-standard boot code and some BIOSes, one disk
>layout (ie, DD or sliced) will work better than the other.  (And for DD
>disks, some slice table contents might work better than others.  I've
>not read anything comparing your "B" and "C" or either with a slice
>table full of zeros or random bits.)

I think to avoid warnings or errors, you need either a valid slice
entry (even if it is a sysinstall-style slice that starts at sector
0 and contains the whole disk), or else the exact special bogus
slice table, since the kernel code just does a bcmp() to check for
the special bogus table.

As to the issue of BIOSes disliking DD modes, there have been a few
different reasons suggested. For traditional BIOSes that just look
for the 0x55 0xaa signature and if found then execute the MBR code,
all of the various DD and non-DD schemes should work fine. However,
some BIOSes perform additional tests that may fail on DD disks. For
example (I'm just guessing here), they might check that the slice
starts after the MBR, or that the slice starts and ends on a cylinder
boundary. It sounds a silly thing to do, but I guess maybe it allows
the BIOS to automatically figure out what geometry the OS is
expecting or something.

The fact that boot1 always contains the bogus slice table even when
boot1 is not used as an MBR has been linked to other BIOS problems
too - some BIOSes apparently go further and check if the first
sector of each slice looks like it has an extended partition table
even if the slice type is not that of an extended partition. In
-CURRENT, the default bogus slice table was changed slightly to
stop some BIOSes crashing with a divide-by-zero error when they
tried to parse the bogus slice entry in boot1.

Ian

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



Re: Dangerously dedicated vs. fully dedicated, etc.

2003-01-14 Thread Gary W. Swearingen
Ian Dowse <[EMAIL PROTECTED]> writes:

> At the risk of adding to the confusion, here is a less wordy
> description of the various disk layouts. The term `dangerously
> dedicated' seems to be used to refer to either options (B) or (C),
> so I will avoid using that term:

You've cleared up several things, thanks. (I still don't see why any
BIOS would have trouble with a DD disk, leading to DD's deprecation, but
I can just take people's word for it, for the task at hand.)  BTW, I've
seen both of your options referred to as DD, if I understood it right.

> (A) Normal sliced disk (assuming sectors/track = 63)
> 
>   sector 0:   boot0 and the DOS slice table

/boot/boot0 has the FreeBSD bootloader.  The installer also offers
to use the "standard" /boot/mbr.

> 
> (B) Dedicated format created by sysinstall
...
>   sector 1:   disklabel
>   sector 2-15:boot2

Roughly speaking.  /boot/boot2 is 15 sectors; I suppose the first
(all zeros) is replaced with the disklabel, loosely speaking.

The installer (and its code) calls this a DD disk.

> (C) Dedicated format using dummy slice
...
One such as would be created by "disklabel -B".  (/boot/boot1 seems to
have the fourth slice pre-defined.)  This differs from "B" only in the
slice table, right?  The "disklabel" manpage implies that this is a DD.


It seems that a DD disk is one which is similar to a single slice
starting at sector 0, regardless of what the slice table part of sector
0 contains.  With FreeBSD-standard boot code and some BIOSes, one disk
layout (ie, DD or sliced) will work better than the other.  (And for DD
disks, some slice table contents might work better than others.  I've
not read anything comparing your "B" and "C" or either with a slice
table full of zeros or random bits.)

Thanks again.

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



Re: Dangerously dedicated vs. fully dedicated, etc.

2003-01-14 Thread Ian Dowse
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes:
>Mike, I'll pay back your effort in replying to this long thing by
>working up a patch for the "disklabel" manpage (at least) and, if you
>want, I'll CC you so you can veto things you don't like.  I do worry

At the risk of adding to the confusion, here is a less wordy
description of the various disk layouts. The term `dangerously
dedicated' seems to be used to refer to either options (B) or (C),
so I will avoid using that term:

(A) Normal sliced disk (assuming sectors/track = 63)

  sector 0: boot0 and the DOS slice table
  sectors 1..62:unused

  
  
  sector 63:boot1
  sector 64:disklabel
  sectors 65-78:boot2
  sectors 79-92:'a' partition filesystem superblock

 Note that the disklabel, which contains a list of the partitions
 within a slice is actually contained within the space allocated to
 the first partition. To ensure that this does not get clobbered by
 the filesystem, the first 8k of every ffs filesystem is reserved for
 boot code and the disklabel.

(B) Dedicated format created by sysinstall

  
  
  sector 0: boot1 and the DOS slice table, where
the slice table contains one slice
(slice 1) covering the entire disk,
including sector 0.
  sector 1: disklabel
  sector 2-15:  boot2
  sectors 16-31:'a' partition filesystem superblock

 In this case, there is no boot0, and boot1 serves as the boot
 loader that is invoked by the BIOS. Here, all of the boot code
 is contained within the first slice and also within the first
 partition. Again, the 8k reserved at the start of every ffs
 filesystem protects the boot code. Sysinstall sets up fstab to
 refer to the partitions as e.g. /dev/ad0s1a (I think).

(C) Dedicated format using dummy slice

  
  
  sector 0: boot1 and the DOS slice table. The slice
table contains a single entry (slice 4)
that starts at sector 0 and has a size
of 5 sectors, whatever the real disk
size is.
  sector 1: disklabel
  sector 2-15:  boot2
  sectors 16-31:'a' partition filesystem superblock

 This is like (B) except that slice 4 instead of slice 1 is used, and
 the size of the slice in the slice table is bogus. The partitions
 on such a disk are usually accessed using the compatibility slice
 names such as /dev/ad0a.

Ian

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



Re: Dangerously dedicated vs. fully dedicated, etc.

2003-01-14 Thread Gary W. Swearingen
Mike, I'll pay back your effort in replying to this long thing by
working up a patch for the "disklabel" manpage (at least) and, if you
want, I'll CC you so you can veto things you don't like.  I do worry
about how so few people comment on manpage changes before they go in,
but they need improvement so badly it's worth the risk of a few errors.
If you can't reply or even read it, that's OK too; I think I learned
something in the writing of it.

Mike Meyer <[EMAIL PROTECTED]> writes:

> In <[EMAIL PROTECTED]>, Gary W. Swearingen <[EMAIL PROTECTED]> 
>typed:
> > I'm having trouble understanding a couple parts of the "disklabel"
> > manpage related to dangerously/fully dedicated disks.
> > 
> > The "BUGS" section has this paragraph:
> > 
> > For the i386 architecture, the primary bootstrap sector contains an
> > embedded fdisk table.  The disklabel utility takes care to not
> > clobber it when installing a bootstrap only (-B), or when editing an
> > existing label (-e), but it unconditionally writes the primary
> > bootstrap program onto the disk for -w or -R, thus replacing the
> > fdisk table by the dummy one in the bootstrap program.  This is only
> > of concern if the disk is fully dedicated, so that the BSD disklabel
> > starts at absolute block 0 on the disk.
> > 
> > 1) Can anyone explain that last sentence to me?  Shouldn't that "is only
> > of concern" instead be "is not of concern", reversing the sense?
> 
> No, it's right.

But you say that a fully dedicated disk has a standard disklabel.  So
the fdisk table is the dummy one, by definition of "standard".  So why
would replacing it with another dummy one concern me (as the quote says
it should)?  I now suspect that "fully" means "dedicated", and I should
be concerned that it's fake fdisk table not get overwritten (but I don't
see why it even needs a fake table -- more below).

And if I have normally sliced disk, whouldn't I also be concerned if
"disklabel" was going to "replace the fdisk table" when it "writes the
primary bootstrap program"?  That depends on definitions.

I was confused by FreeBSD referring to boot1 as the "primary bootstrap"
while it seems so obvious that boot0 (MBR) is the primary bootstrap.
The about manpage quote seemed to imply that the MBR's "fdisk table"
could be overwritten; made even more wrong because there is no other
fdisk table, really.  The boot1 dummy table is not an "fdisk table"
because fdisk knows nothing about it on a sliced disk.  I think "only of
concern if" should be "only true if".

I think there's a terminology mess here.  Looking further, I see that my
filesystem has a block size of 16384, but disklabel.c seems to use a
"boot block" size of 8192 (presumably to fit in /boot/boot1 (512) and
/boot/boot2 (7680, part of which is a placeholder for the disklabel
sector); which the code refers to as "block 0" and "block 1-15"!

> > 2) Is a "fully dedicated" disk exactly the same as a "dangerously
> > dedicated" disk?  If not, what's the difference?  Can one use a disk
> > (or a slice) which has no space reserved for stage 1 & 2 boot records,
> > say, for a non-bootable disk?  I know no way to disklabel one that way.
> 
> I've never seen "fully dedicated" anywhere else, so I can't say for
> sure. However, I suspect they are using that to distinguish a drive on
> a non-PC system - which has a standard disklabel in block 0 - from a
> dangerously dedicated drive, which has a dangerously dedicated
> disklabel in block 0.

So then what's the difference between "a standard disklabel" and
"a dangerously dedicated disklabel"?  Is it only that the std one has
a dummy partition table and the DD one has a "fake" table, where "dummy"
means "whatever is in boot1 (some warning text?)" and "fake" means "some
data as if the disk was sliced"?  (More below.)

> > 3) Is "block 0" exactly the same as "sector 0"?
> 
> No. Block 0 is a file system block, whose size depends on the
> parameters you gave newfs when you created the file system. I've seen
> reports that booting won't work if you don't use the default values on
> the root file system, but have never verified them. Sector 0 is the
> first sector of block 0.

It looked to me like disklabel.c is using 8192, regardless of FS params.
I don't know why my root FS has 16384 since it's less than 1 GB so it's
supposed to be 8192.  But it boots.

> > 4) Shouldn't "BSD disklabel starts at absolute block 0" be "FreeBSD
> > stage 1 boot record starts at sector 0"?  The disklabel immediately
> > follows the stage 1 boot record, right?  So it would be "block 1"?
> 
> No, both the stage 1 boot and the disklabel are in block 0.

OK, I guess the "block 0" is true (but confusing), but I like your
disklabel "in block 0" a lot better than the manpages's "starts at block
0".
 
> > Under "Writing a standard label", the manpage says:
> > 
> > PC-based systems have special requirements in order for the BIOS to
> > properly recognize a FreeBSD disklabel.  Older sys

Re: Dangerously dedicated vs. fully dedicated, etc.

2003-01-14 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Gary W. Swearingen <[EMAIL PROTECTED]> typed:
> I'm having trouble understanding a couple parts of the "disklabel"
> manpage related to dangerously/fully dedicated disks.
> 
> The "BUGS" section has this paragraph:
> 
> For the i386 architecture, the primary bootstrap sector contains an
> embedded fdisk table.  The disklabel utility takes care to not
> clobber it when installing a bootstrap only (-B), or when editing an
> existing label (-e), but it unconditionally writes the primary
> bootstrap program onto the disk for -w or -R, thus replacing the
> fdisk table by the dummy one in the bootstrap program.  This is only
> of concern if the disk is fully dedicated, so that the BSD disklabel
> starts at absolute block 0 on the disk.
> 
> 1) Can anyone explain that last sentence to me?  Shouldn't that "is only
> of concern" instead be "is not of concern", reversing the sense?

No, it's right.

> 2) Is a "fully dedicated" disk exactly the same as a "dangerously
> dedicated" disk?  If not, what's the difference?  Can one use a disk
> (or a slice) which has no space reserved for stage 1 & 2 boot records,
> say, for a non-bootable disk?  I know no way to disklabel one that way.

I've never seen "fully dedicated" anywhere else, so I can't say for
sure. However, I suspect they are using that to distinguish a drive on
a non-PC system - which has a standard disklabel in block 0 - from a
dangerously dedicated drive, which has a dangerously dedicated
disklabel in block 0.

> 3) Is "block 0" exactly the same as "sector 0"?

No. Block 0 is a file system block, whose size depends on the
parameters you gave newfs when you created the file system. I've seen
reports that booting won't work if you don't use the default values on
the root file system, but have never verified them. Sector 0 is the
first sector of block 0.

> 4) Shouldn't "BSD disklabel starts at absolute block 0" be "FreeBSD
> stage 1 boot record starts at sector 0"?  The disklabel immediately
> follows the stage 1 boot record, right?  So it would be "block 1"?

No, both the stage 1 boot and the disklabel are in block 0.

> Under "Writing a standard label", the manpage says:
> 
> PC-based systems have special requirements in order for the BIOS to
> properly recognize a FreeBSD disklabel.  Older systems may require
> what is known as a ''dangerously dedicated'' disklabel, which
> creates a fake DOS partition to work around problems older BIOSes
> have with modern disk geometries.
> 
> 5) What's "fake DOS partition"?  DD disks don't have partitions.  Is it
> just trying to not bother saying that it fills in the MBR partition
> table as if there was at least one slice which the DD MBR will ignore.

DD disks don't have fdisk partitions, but they have an fdisk table. It
has one partition that covers the entire disk. That's probably what
they are referring to. Note that the system also supports accessing
the drive as if it had one fdisk partition, so that da0s1a and da0a
reference the same bit of disk if da0 is DD.

> 6) Why is the problem limited to older systems?  Don't new BIOSes
> check for a normal-looking partition table?

The BIOS checking the fdisk table isn't what you're avoiding with a DD
disk. What you're avoiding is the BIOS geometry calculations at boot
time. Older BIOSes apparently have trouble with that.

> 7) Isn't the first sentence wrong?  BIOS don't look for disklabels, do
> they?  The special requirements are in order for the BIOS to find the
> FreeBSD stage 1 boot record, no?. (And the FreeBSD installer doesn't
> satisfy the requirements for non-DD disks (as I read the FAQ's DD
> answer).  I can't imagine why not.  Older systems with a standard
> MBR boot any active slice (even FreeBSD) without problems, no?)

I think the first sentence has confusing wording, in that PC BIOSes
could be confused if there wasn't an fdisk table. It should say
"recognize disks with a FreeBSD disklabel."

A standard FreeBSD disklabel does *not* have an fdisk table in
it. That's what gets put at the beginning of fdisk partitions, and at
the beginning of disks on non-PC based systems. If you put that at the
beginning of a disk on a PC, you could confuse the BIOS. The special
requirements are that you have an fdisk table.

On non-DD disks, the FreeBSD installer installs either a standard MBR
or a boot0 MBR, both of which have an fdisk table. It then installs
standard disk labels on the fdisk partitions, where they won't confuse
anything.

  http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

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



Dangerously dedicated vs. fully dedicated, etc.

2003-01-13 Thread Gary W. Swearingen
I'm having trouble understanding a couple parts of the "disklabel"
manpage related to dangerously/fully dedicated disks.

The "BUGS" section has this paragraph:

For the i386 architecture, the primary bootstrap sector contains an
embedded fdisk table.  The disklabel utility takes care to not
clobber it when installing a bootstrap only (-B), or when editing an
existing label (-e), but it unconditionally writes the primary
bootstrap program onto the disk for -w or -R, thus replacing the
fdisk table by the dummy one in the bootstrap program.  This is only
of concern if the disk is fully dedicated, so that the BSD disklabel
starts at absolute block 0 on the disk.

1) Can anyone explain that last sentence to me?  Shouldn't that "is only
of concern" instead be "is not of concern", reversing the sense?

2) Is a "fully dedicated" disk exactly the same as a "dangerously
dedicated" disk?  If not, what's the difference?  Can one use a disk
(or a slice) which has no space reserved for stage 1 & 2 boot records,
say, for a non-bootable disk?  I know no way to disklabel one that way.

3) Is "block 0" exactly the same as "sector 0"?

4) Shouldn't "BSD disklabel starts at absolute block 0" be "FreeBSD
stage 1 boot record starts at sector 0"?  The disklabel immediately
follows the stage 1 boot record, right?  So it would be "block 1"?

Under "Writing a standard label", the manpage says:

PC-based systems have special requirements in order for the BIOS to
properly recognize a FreeBSD disklabel.  Older systems may require
what is known as a ''dangerously dedicated'' disklabel, which
creates a fake DOS partition to work around problems older BIOSes
have with modern disk geometries.

5) What's "fake DOS partition"?  DD disks don't have partitions.  Is it
just trying to not bother saying that it fills in the MBR partition
table as if there was at least one slice which the DD MBR will ignore.

6) Why is the problem limited to older systems?  Don't new BIOSes
check for a normal-looking partition table?

7) Isn't the first sentence wrong?  BIOS don't look for disklabels, do
they?  The special requirements are in order for the BIOS to find the
FreeBSD stage 1 boot record, no?. (And the FreeBSD installer doesn't
satisfy the requirements for non-DD disks (as I read the FAQ's DD
answer).  I can't imagine why not.  Older systems with a standard
MBR boot any active slice (even FreeBSD) without problems, no?)

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