Subject: Re: how to add a partition beyond BIOS cylinder 1024
To: None <netbsd-help@netbsd.org>
From: Russell McManus <russell_mcmanus@yahoo.com>
List: netbsd-help
Date: 06/16/2003 00:08:33
rtr@netbsd.org (Tyler Retzlaff) writes:

> What fdisk command line opts are you using to create the new MSDOS
> partition?  Are you using the interactive editor or just specifying
> via command line?

I am using the interactive fdisk feature. 'fdisk -u wd0', I believe.

When I type in the offset and size that I want for the new partition,
fdisk does not reflect the input, basically truncating the values to
match some notion of the disk size, apparently to make sure that no
partition extends beyond 1023 cylinders.  When I was not able to get
fdisk to display the values that I wanted for start/end in the new
partition, I exited the program so as not to smash my system.

One interesting thing that I think I failed to mention in sufficient
detail in my original post is that fdisk claims that the size of
partition 1 is 10000 MB (9.77 GB), but this information does not match
with the information given about beginning and ending location just
below, which is expressed in terms of cylinder/head/sector.

For example, in the example fdisk output below, fdisk says that
partition 1 starts at block 8179920 (3.9 GB from the start of the
disk), and has size 20480544 (9.77 GB).  This seems fine.

Just below that fdisk also says that partition 1 begins at cylinder
541, head 0, sector 1.  Assuming that that a cylinder has (* 240 63) =
15120 blocks, this comes to 8179920, which matches.  Good.

However fdisk claims that partition 1 ends at cylinder 1022, head 239,
sector 63.  I compute this to be at block 15467760 or thereabouts,
which is only 7.4 GB from the start of the disk.  Subtracting 8179920
from 15467760 yields 7287840, which is 3.5 GB, so when computed this
way fdisk is saying that partition 1 is 3.5GB instead of 9.77 GB as
above.  Bad.

> looks to me like `fdisk -2 -s 7/28660464/10409616 /dev/wd0` should work
> (based on the values in your post).

I've always used the interactive feature of fdisk before.  (The command
line version is actually easier if you calculate sizes by hand ahead
of time, as I often do.  Neat.)

I just tried the command you supplied, verbatim.  fdisk returned
without any output, and afterwards, there is no change to partition 2.

Here is the interaction output cut and pasted:

mingus:/root [11] # fdisk -2 -s 7/28660464/10409616 /dev/wd0
Disk: /dev/wd0d
NetBSD disklabel disk geometry:
cylinders: 16383 heads: 16 sectors/track: 63 (1008 sectors/cylinder)

BIOS disk geometry:
cylinders: 1023 heads: 240 sectors/track: 63 (15120 sectors/cylinder)

Partition table:
<UNUSED>
mingus:/root [12] # fdisk wd0                                
Disk: /dev/rwd0d
NetBSD disklabel disk geometry:
cylinders: 16383 heads: 16 sectors/track: 63 (1008 sectors/cylinder)

BIOS disk geometry:
cylinders: 1023 heads: 240 sectors/track: 63 (15120 sectors/cylinder)

Partition table:
0: sysid 7 (OS/2 HPFS or NTFS or QNX2 or Advanced UNIX)
    start 63, size 8179857 (3994 MB), flag 0x0
        beg: cylinder    0, head   1, sector  1
        end: cylinder  540, head 239, sector 63
1: sysid 169 (NetBSD)
    start 8179920, size 20480544 (10000 MB), flag 0x80
        beg: cylinder  541, head   0, sector  1
        end: cylinder 1022, head 239, sector 63
2: <UNUSED>
3: <UNUSED>


> As for the fdisk partitions not agreeing with the disklabel I don't see
> it?  Ignore the CHS and pay attention to the offset/size in sectors here.
> 
> Could you paste the exact error message if it occurs w/ the above, thanks.

I have tried to be more explicit about why I am confused, and about
what is not working.  Please let me know if I have not succeeded, and
thanks for looking at the problem.

-russ