Subject: Re: disklabel/fdisk confusion
To: Rasputin <rasputin@shikima.mine.nu>
From: FUKAUMI Naoki <naoki@fukaumi.org>
List: port-hpcmips
Date: 04/18/2002 01:28:45
At Wed, 17 Apr 2002 14:16:52 +0100,
Rasputin wrote:
> =FDISK==========================================
> 
> NetBSD disklabel disk geometry:
> cylinders: 978 heads: 8 sectors/track: 32 (256 sectors/cylinder)
> 
> BIOS disk geometry:
> cylinders: 978 heads: 8 sectors/track: 32 (256 sectors/cylinder)
> 
> Partition table:
> 0: sysid 6 (Primary 'big' DOS, 16-bit FAT (> 32MB))
>     start 32, size 12000 (5 MB), flag 0x80
> 	beg: cylinder    0, head   1, sector  1
> 	end: cylinder   46, head   7, sector 32

sysid 4 is better. (not important)

> 1: sysid 169 (NetBSD)
>     start 12033, size 250000 (122 MB), flag 0x0
> 	beg: cylinder   47, head   0, sector  2
> 	end: cylinder  977, head   7, sector 32

you can use 'start 12032'.

size 250000 is wrong.

  978 * 8 * 32 (chs) = total sector is 250368
  start 12033 + size 250000 = last sector is 262032 (wrong)

if you set start 12032, right size is 238336.

> 2: <UNUSED>
> 3: <UNUSED>
> 
> =DISKLABEL==========================================
> 
> # /dev/rwd1d:
> type: ESDI
> disk: TOSHIBA THNCF128
> label: fictitious
> flags:
> bytes/sector: 512
> sectors/track: 32
> tracks/cylinder: 8
> sectors/cylinder: 256
> cylinders: 978
> total sectors: 250368
> rpm: 3600
> interleave: 1
> trackskew: 0
> cylinderskew: 0
> headswitch: 0		# microseconds
> track-to-track seek: 0	# microseconds
> drivedata: 0 
> 
> 8 partitions:
> #        size   offset     fstype   [fsize bsize cpg/sgs]
>   a:   235520       47     4.2BSD     1024  8192    16   # (Cyl.    0*- 920*)
>   b:    14592   235776       swap                        # (Cyl.  921 - 977)
>   c:   235520    12033     unused        0     0         # (Cyl.   47*- 967*)
>   d:   250368        0     unused        0     0         # (Cyl.    0 - 977)
>   e:    12000       32      MSDOS                        # (Cyl.    0*- 46)

partition a and e are overwrapped. a: offset 47 is wrong.
(size and offset (start) is sector #, not cylinder #)
partition c size is strange.

if you can erase all data, try to clear current fdisk/disklabel completely
  $ dd if=/dev/zero of=/dev/rwd1d count=100
                            ^^^^^ <- CF device name
then create new disklabel.

FYI

If you want to add MSDOS partition infomation to NetBSD disklabel,
mbrlabel command is very useful. start and size # will be auto-generated
from fdisk infomation.

MSDOS partition can be formated on NetBSD with newfs_msdos command.

--
FUKAUMI Naoki