fdisk question (long)

Malcolm Kay malcolm.kay at internode.on.net
Tue Dec 2 05:59:25 PST 2003


On Tue, 2 Dec 2003 21:20, Ion-Mihai Tetcu wrote:
> Hope someone will have the pacince to read all this ...
>
> I have a 120G HDD, in the BIOS is set as LBA. I've RTFM as much as I
> could, but there still are some things I clearly don't understand. I
> want to be sure that I can move this disk to another machine with
> anouter BIOS and the system still boots up.
>
> I've used sysinstall to make partitions and the result is bellow:
>
>
> it# fdisk ad0
> ******* Working on device /dev/ad0 *******
> parameters extracted from in-core disklabel are:
> cylinders=232578 heads=16 sectors/track=63 (1008 blks/cyl)
>
> Figures below won't work with BIOS for partitions not in cyl 1
> parameters to be used for BIOS calculations are:
> cylinders=232578 heads=16 sectors/track=63 (1008 blks/cyl)
>

These figures are just figures that will probably work -- and are
unlikely to have any connection to the physical disk structure.

> 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 165 (0xa5),(FreeBSD/NetBSD/386BSD)
>     start 63, size 497952 (243 Meg), flag 0
>         beg: cyl 0/ head 1/ sector 1;
>         end: cyl 30/ head 254/ sector 63

Having sthe geometry set to 23578/16/63 (that is sixteen heads)
it is rather strange to address head number 254. Maximum head 
number should then be 15.

However it is also quite common to define large disk geometries
as nnnnnn/255/63 which allows a maximum head number of 254.

> The data for partition 2 is:
> sysid 6 (0x06),(Primary 'big' DOS (>= 32MB))
>     start 498015, size 41929650 (20473 Meg), flag 0
>         beg: cyl 31/ head 0/ sector 1;
>         end: cyl 1023/ head 254/ sector 63

The CHS descriptor has overflowed -- nolonger meaningful.
LBA works with the 498015/41929650 figures.

> The data for partition 3 is:
> sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
>     start 42427665, size 192008880 (93754 Meg), flag 0
>         beg: cyl 1023/ head 255/ sector 63;
>         end: cyl 1023/ head 254/ sector 63
> The data for partition 4 is:
> <UNUSED>
>
> Q1: How can the partition 3 end up before beginning ?
>

The CHS entries are limited to 1023/255/63 which does not come anywhere
near the disk capacity -- so once C reaches 1023 the CHS recording capacity 
has been exceeded. Or to put it another way the CHS entries are somewhat
meaningless on large disks. But the absolute start sector number and slice 
size is also recorded in the slice/partition table and this is used in LBA 
mode.

> Q2: What is the Warning: BIOS sector numbering starts with sector 1
> trying to say ? The cylinders=232578 heads=16 sectors/track=63 shows the
> same as in teh BIOS screen.
>

Cylinder and head numbering starts at 0; sectors start at 1. A quirk of
history that you need to know when using CHS.

> Q3: The in-core parameters and those for BIOS calculation are the same;
> this normal (from my experince) / when they won't mach ?
>
> So i decided to make it by hand (note that sysid 0 for the first
> partition is a typo - it should be 165 and I'll want the / slice on it,
> and I want to reserve the second partition for a winXP, and the 3rd will
> be for the other slices).
>
...
> Q4: I've supplied the start and size parameters by reading those
> provided by the sysinstall partitioning. How can I calculate them ?
>

Work with absolute sector numbers but chosen so that a slice always 
starts at sector 1 in the CHS scheme.

> Q5: Why the new parameters are different from those of sysinstall ?
>

Possibly a change of assumed CHS geometry

> Q6: Is this schema OK and will I be able to use this disk in an other
> computer and access all the partitions and slices ?

Probably but I would feel happier with sysinstall generated values.

Malcolm


More information about the freebsd-questions mailing list