Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jun 2002 23:24:01 +0200
From:      hans@lambermont.dyndns.org (Hans Lambermont)
To:        freebsd-stable@freebsd.org
Cc:        freebsd-fs@freebsd.org
Subject:   fdisk seems broken for slices above cyl 1023
Message-ID:  <20020616232401.C91106@moya.lambermont.dyndns.org>

next in thread | raw e-mail | index | archive | help
Hi,

I'm battling with fdisk on a 20 GB disk with 4 slices.

This is the disk:
ad0: 19077MB <TOSHIBA MK2018GAP> [38760/16/63] at ata0-master UDMA100
On FreeBSD 4.6-RC #1: Sun Jun 16 2002
Fdisk translates the geometry to : cylinders=2584 heads=240
sectors/track=63 (15120 blks/cyl)

This disk was partitioned during sysinstal in 4 slices:
    /dev/ad0s1 Suspend to Disk, 0.3 GB
    /dev/ad0s2 FreeBSD slice 1, 8.3 GB
    /dev/ad0s3 FreeBSD slice 2, 8.3 GB
    /dev/ad0s4 other,           2.4 GB

fdisk -i shows:
    ******* Working on device /dev/ad0 *******
    parameters extracted from in-core disklabel are:
    cylinders=2584 heads=240 sectors/track=63 (15120 blks/cyl)
 
    Figures below won't work with BIOS for partitions not in cyl 1
    parameters to be used for BIOS calculations are:
    cylinders=2584 heads=240 sectors/track=63 (15120 blks/cyl)
    240*63 = 15120 sectors/cyl
 
    Media sector size is 512
    Warning: BIOS sector numbering starts with sector 1
    Information from DOS bootblock is:
    The data for partition 1 is:
    sysid 160,(Suspend to Disk)
        start 63, size 604737 (295 Meg), flag 0
            beg: cyl 0/ head 1/ sector 1;
            end: cyl 39/ head 239/ sector 63
    The data for partition 2 is:
    sysid 165,(FreeBSD/NetBSD/386BSD)
        start 604800, size 16768080 (8187 Meg), flag 80 (active)
            beg: cyl 40/ head 0/ sector 1;
            end: cyl 1023/ head 239/ sector 63
    The data for partition 3 is:
    sysid 165,(FreeBSD/NetBSD/386BSD)
        start 17372880, size 16768080 (8187 Meg), flag 0
            beg: cyl 1023/ head 255/ sector 63;
            end: cyl 1023/ head 239/ sector 63
    The data for partition 4 is:
    sysid 6,(Primary 'big' DOS (> 32MB))
        start 34140960, size 4929120 (2406 Meg), flag 0
            beg: cyl 1023/ head 255/ sector 63;
            end: cyl 1023/ head 239/ sector 63

Note that in slice 2 the 1023 cylinder is crossed, from here on all
begin/end cylinder stuff is corrupt (all set to 1023).

So I calculated (*sweat*) the right start/end cylinders, heads and
sectors. This is what it should have been:

    s1 start 63, size 604737
       beg: cyl 0 head 1 sector 1       (0*15120 + 1*63 + 1-1 = 63)
       end: cyl 39 head 239 sector 63   (39*15120 + 239*63 + 63-1 = 604799)
    s2 start 604800, size 16768080
       beg: cyl 40 head 0 sector 1      (40*15120 + 0*63 + 1-1 = 604800)
       end: cyl 1148 head 239 sector 63 (1148*15120 + 239*63 + 63-1 = 17372879)
    s3 start 17372880, size 16768080
       beg: cyl 1149 head 0 sector 1    (1149*15120 + 0*63 + 1-1 = 17372880)
       end: cyl 2257 head 239 sector 63 (2257*15120 + 239*63 + 63-1 = 34140959)
    s4 start 34140960, size 4929120
       beg: cyl 2258 head 0 sector 1    (2258*15120 + 0*63 + 1-1 = 34140960)
       end: cyl 2583 head 239 sector 63 (2583*15120 + 239*63 + 63-1 = 39070079)

I wanted to change the sysid of slice 4, for this I have to fix all
corrupt start/end settings first, because the whole table is written
and not just the new sysid. So here is the first slice with corrupt
begin/end settings:

fdisk -u, select slice 2, try to fix the corrupt end cylinder from 1023
to 1148 :

    sysid 165,(FreeBSD/NetBSD/386BSD)
        start 604800, size 16768080 (8187 Meg), flag 80 (active)
            beg: cyl 40/ head 0/ sector 1;
            end: cyl 1023/ head 239/ sector 63
    Do you want to change it? [n] y
    Supply a decimal value for "sysid (165=FreeBSD)" [165]
    Supply a decimal value for "start" [604800]
    Supply a decimal value for "size" [16768080]
    Explicitly specify beg/end address ? [n]
    sysid 165,(FreeBSD/NetBSD/386BSD)
        start 604800, size 16768080 (8187 Meg), flag 80 (active)
            beg: cyl 40/ head 0/ sector 1;
            end: cyl 124/ head 239/ sector 63

what ?! 124 ? This is not correct, so :

    Are we happy with this entry? [n] n
    Supply a decimal value for "sysid (165=FreeBSD)" [165]
    Supply a decimal value for "start" [604800]
    Supply a decimal value for "size" [16768080]
    Explicitly specify beg/end address ? [n] y
    Supply a decimal value for "beginning cylinder" [40]
    Supply a decimal value for "beginning head" [0]
    Supply a decimal value for "beginning sector" [1]
    Supply a decimal value for "ending cylinder" [124] 1148
    Supply a decimal value for "ending head" [239]
    Supply a decimal value for "ending sector" [63]
    sysid 165,(FreeBSD/NetBSD/386BSD)
        start 604800, size 16768080 (8187 Meg), flag 80 (active)
            beg: cyl 40/ head 0/ sector 1;
            end: cyl 124/ head 239/ sector 63

Still 124 ?!

This is seriously wrong. This looks like an fdisk bug to me.
Any help is appreciated.

Hans Lambermont
-- 
http://lambermont.webhop.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020616232401.C91106>