Subject: Re: Wrong "fake" disklabel for USB-dev with MSDOS partition on NBSD4
To: David Laight <david@l8s.co.uk>
From: Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen <lhp@toft-hp.dk>
List: netbsd-help
Date: 01/15/2007 22:44:33
David Laight wrote:
>I suspect that it has everything to do with the line:
>
>> sd1: mbr partition exceeds disk size
>
>and the equivalent one from fdisk. Which probably means that the 'disk'
>is lying about its size somewhere. You didn't give any of the info from
>the driver or fdisk about the volume size. The output from the following
>will (probably) be useful as well.
On netbsd4, fdisk says (the phone is now on sd0):
able:~ $ sudo fdisk sd0
Disk: /dev/rsd0d
NetBSD disklabel disk geometry:
cylinders: 59, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 121821
BIOS disk geometry:
cylinders: 238, heads: 16, sectors/track: 32 (512 sectors/cylinder)
total sectors: 121821
Partition table:
0: Primary 'big' DOS, 16-bit FAT (> 32MB) (sysid 6)
start 35, size 121821 (59 MB, Cyls 0/1/4-238), Active
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
>$ hexdump -C -s432 -n80 /dev/sd0d
>$ hexdump -C -s35b -n112 /dev/sd0d
able:~ $ sudo hexdump -C -s432 -n80 /dev/sd0d
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 01 |................|
000001c0 04 00 06 0f 20 ed 23 00 00 00 dd db 01 00 00 00 |.... .#.........|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200
able:~ $ sudo hexdump -C -s35b -n112 /dev/sd0d
00004600 eb 00 90 4d 53 57 49 4e 34 2e 31 00 02 20 01 00 |...MSWIN4.1.. ..|
00004610 02 00 02 00 00 f8 0c 00 3f 00 ff 00 01 00 00 00 |........?.......|
00004620 be db 01 00 00 00 29 7b ba aa 45 50 48 4f 4e 45 |......){..EPHONE|
00004630 20 43 41 52 44 20 46 41 54 31 32 20 20 20 00 00 | CARD FAT12 ..|
00004640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00004650 00 00 00 00 00 00 00 00 00 00 11 47 4c e8 0b 08 |...........GL...|
00004660 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00004670
So you are right, somethings obviously wrong with the sizes here.
I then proceeded to check again with NetBSD 3 and with my Olympus camera.
It turns out that the camera (which has correctly sized partitions) works
with NetBSD 4 as well. I could have sworn that I tested it back when I
discovered the problem and it didn't work. But it does. I guess that's
typical: when you ask for help, some problems just go away. Thanks.
Still, if you could explain why the phone doesn't come up the same
in both systems, I'd be grateful. Here is the disklabel as it is shown
with NetBSD 3.1 again:
5 partitions:
# size offset fstype [fsize bsize cpg/sgs]
d: 121821 0 unused 0 0 # (Cyl. 0 - 59*)
e: 121821 35 MSDOS # (Cyl. 0*- 59+)
disklabel: boot block size 0
disklabel: super block size 0
disklabel: partition e: partition extends past end of unit
So it knows it's a bad partition, but at least the fake disklabel has the
correct slice e, at the right offset, and of the right type. Shouldn't that
be possible on NetBSD 4, then?
4 partitions:
# size offset fstype [fsize bsize cpg/sgs]
a: 121821 0 4.2BSD 0 0 0 # (Cyl. 0 - 59*)
d: 121821 0 unused 0 0 # (Cyl. 0 - 59*)
disklabel: boot block size 0
disklabel: super block size 0
I'd be happy to understand a little more about what's going on here,
before I try to format the card in my phone.
-Lasse, still puzzled