Subject: Re: Wrong "fake" disklabel for USB-dev with MSDOS partition on NBSD4
To: Lasse Hiller?e Petersen <lhp@toft-hp.dk>
From: David Laight <david@l8s.co.uk>
List: netbsd-help
Date: 01/15/2007 22:59:16
On Mon, Jan 15, 2007 at 10:44:33PM +0100, Lasse Hiller?e Petersen wrote:
> 
> 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

FAT filesystem details....
> 00004600  eb 00 90 4d 53 57 49 4e  34 2e 31 00 02 20 01 00  |...MSWIN4.1.. ..|
                                                       ^^^^^ 1 reserved sector
               ^^ should be length of bpb           ^^ 32 sec/cluster
					      ^^^^^ 512 bytes/sector
> 00004610  02 00 02 00 00 f8 0c 00  3f 00 ff 00 01 00 00 00  |........?.......|
			      ^^^^^ 12 sec/FAT   ^^^^^^^^^^^ 1 hidden sector
               ^^^^^ 512 root dir entries  ^^^^^ 255 heads
	    ^^ 2 copies of FAT       ^^^^^ 63 sector/track
> 00004620  be db 01 00 00 00 29 7b  ba aa 45 50 48 4f 4e 45  |......){..EPHONE|
            ^^^^^^^^^^^ 121790 sectors
 
> So you are right, somethings obviously wrong with the sizes here.

Badly!
The 'hidden sector' count should be the offset from the beginning of the
disk - ie 35.
The filesystem size of 121790 doesn't match the 121821 reported for the
media size (which is incorrectly used as the size of the mbr partition).
121790+35 = 121825, so the fs ends beyond the end of the media.

You want to raise a bug report on the phone...
But that will probably be about as sucessful as we were with some CF cards
that gave incorrect responses to the 'identify' command (or locked solid
when asked to do it.)

> 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:

Additional sanity checks....

You might find that the instructions with mbrlabel might let you
mount the card.

	David

-- 
David Laight: david@l8s.co.uk