Re: Problem with new IDE disk

2007-08-24 Thread Stéphane Chausson

Miod Vallat wrote, On 23/08/07 15:50:

# fdisk -i wd2
# disklabel -E wd2 (created 'a' partition)
# newfs wd2a


[...]

wd2a: id not found writing fsbn 488397104 (wd2 bn 8796581419375; cn  
547561868 tn 158 sn 1), retrying


It looks like you are indeed running a -CURRENT (or fairly recent) kernel,
but with an older userland.

Are you sure your fdisk, disklabel and newfs binaries are on par with the
kernel?

Miod



It may be trivial but I wonder where in the line you highlighted is the
clue that gave you the answer.



Re: Problem with new IDE disk

2007-08-24 Thread Miod Vallat

wd2a: id not found writing fsbn 488397104 (wd2 bn 8796581419375;
cn  547561868 tn 158 sn 1), retrying



It may be trivial but I wonder where in the line you highlighted is the
clue that gave you the answer.


During the 4.1-4.2 development cycle, the disklabel layout has been
modified to allow sector numbers of up to 48 bits, instead of 32 bits.
This has been done by ``packing'' existing fields of the structure,
to get room for the extended values.

Disklabel handling is done by both the kernel (which needs to read
the label for its own needs, and also provides ioctls for userland
tools to be able to read and write labels), and the userland system
administration tools such as disklabel(8).

Of course, for this to work correctly, all the involved components
need to agree on the disklabel layout.

In the OP's problem, the wd2a error message reports an unreachable
block number (bn value) with is a huge number, which fits in 48 bits,
but won't in 32. This is a sure sign that disklabel(8) wrote an
old-style label on the disk.

What exactly happened was:
- there was no label on the disk.
- disklabel -E starts by reading the label. Since there wasn't any,
  the kernel returns an empty label, flagged as being a ``new-style''
  48 bit layout.
- disklabel itself (because it is still the 4.1 binary) does not
  know about the new style format, and happily constructs a 32-bit
  style label. Unfortunately, this does not overwrite the ``new-style''
  flag.
- when disklabel asks the kernel to write the new label, the kernel
  does so and handles the label disklabel gave it as a ``new-style''
  format, not knowing that it comes from the old disklabel binary.

Editing the label with the old binary causes extra high-order bits
to appear where the new layout stores the higher part of a 48 bit
value on little-endian platforms; this causes the partition, which
disklabel wants to start at sector #0x.00xx (a 32 bit value), to
be handled by the kernel as #0x0800..00xx (a 48 bit value). And
of course, this sector number does not exist on the device, hence the
I/O errors.

Miod



Problem with new IDE disk

2007-08-23 Thread Xavier Mertens
Hi *,
I just reinstalled a box (running -CURRENT). I added a third IDE drive:

wd2 at pciide0 channel 1 drive 1: WDC WD2500JB-00REA0
wd2: 16-sector PIO, LBA48, 238475MB, 488397168 sectors
wd2(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 5
dkcsum: wd2 matches BIOS drive 0x82

It will be fully dedicated to OpenBSD so, I issued the following commands:

# fdisk -i wd2
# disklabel -E wd2 (created 'a' partition)
# newfs wd2a

== Errors!

wd2a: id not found writing fsbn 488397104 (wd2 bn 8796581419375; cn 547561868 
tn 158 sn 1), retrying
wd2: transfer error, downgrading to Ultra-DMA mode 4
wd2(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 4
wd2a: id not found writing fsbn 488397104 (wd2 bn 8796581419375; cn 547561868 
tn 158 sn 1), retrying
wd2: transfer error, downgrading to Ultra-DMA mode 3
wd2(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 3
wd2a: id not found writing fsbn 488397104 (wd2 bn 8796581419375; cn 547561868 
tn 158 sn 1), retrying

I booted the box with a Knoppix CD and I was able to create an ext3 fs on the 
disk.
The filesystem was successfully mounted under OpenBSD and I/O were correct.
Any idea why newfs failed?

Regards,
Xavier
--
The three Rs of Microsoft support: Retry, Reboot, Reinstall.



Re: Problem with new IDE disk

2007-08-23 Thread Miod Vallat

# fdisk -i wd2
# disklabel -E wd2 (created 'a' partition)
# newfs wd2a


[...]

wd2a: id not found writing fsbn 488397104 (wd2 bn 8796581419375; cn   
547561868 tn 158 sn 1), retrying


It looks like you are indeed running a -CURRENT (or fairly recent) kernel,
but with an older userland.

Are you sure your fdisk, disklabel and newfs binaries are on par with the
kernel?

Miod



Re: Problem with new IDE disk

2007-08-23 Thread Xavier Mertens
Argh! So stupid!
I just started a rebuild of userland tools... I'll keep you informed.
Tx Miod!

Xavier
--
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)

On Thu, 23 Aug 2007, Miod Vallat wrote:

  # fdisk -i wd2
  # disklabel -E wd2 (created 'a' partition)
  # newfs wd2a
 
 [...]
 
  wd2a: id not found writing fsbn 488397104 (wd2 bn 8796581419375; cn
  547561868 tn 158 sn 1), retrying
 
 It looks like you are indeed running a -CURRENT (or fairly recent) kernel,
 but with an older userland.
 
 Are you sure your fdisk, disklabel and newfs binaries are on par with the
 kernel?
 
 Miod



Re: Problem with new IDE disk

2007-08-23 Thread Xavier Mertens
Ok, problem solved, it was indeed a mismatch between kernel  userland!
Tx!

Xavier
--
The first time that Microsoft makes a product that doesn't suck
will be when they start making vacuum cleaners!

On Thu, 23 Aug 2007, Miod Vallat wrote:

  # fdisk -i wd2
  # disklabel -E wd2 (created 'a' partition)
  # newfs wd2a
 
 [...]
 
  wd2a: id not found writing fsbn 488397104 (wd2 bn 8796581419375; cn
  547561868 tn 158 sn 1), retrying
 
 It looks like you are indeed running a -CURRENT (or fairly recent) kernel,
 but with an older userland.
 
 Are you sure your fdisk, disklabel and newfs binaries are on par with the
 kernel?
 
 Miod