strange fdisk numbers
Bruce Evans
bde at zeta.org.au
Fri Feb 23 10:11:46 UTC 2007
On Thu, 22 Feb 2007, j w wrote:
> I am working up the courage to use growfs, but got a little confused
> by fdisk's numbers.
> The output is below, but what interests me is that it says "heads=16",
> but then later on has some partitions(slices) saying "head 254" and
> such
This has been broken since FreeBSD-4.
> there's 16 tracks/cylinder, so maybe that figures in the calculation
> somehow? (16 tracks * 16 heads ?)
>
> I put the output of bsdlabel -A as well
> ******* Working on device /dev/ad2 *******
> parameters extracted from in-core disklabel are:
> cylinders=26310 heads=16 sectors/track=63 (1008 blks/cyl)
After FreeBSD-4, almost everything is broken here:
o The parameters weren't actually extracted from the in-core disk label.
They were extracted from the "firmware". The "firmware" is usually
the drive firmware, except possibly for very old drives which have broken
or barely existing firmware, in which case the parameters are fictitious.
o The firmware parameters are not the ones needed here. The BIOS parameters
are the ones needed.
In FreeBSD[2-4], the parameters here were actually extracted from the
in-core disk label (for the whole disk), and the latter were set to the
system's best guess at the BIOS parameters, so they were actually useful
here and in sysinstall's fdisk in cases where they were guessed correctly
(mainly in cases where a non-weird fisk table already existed; otherwise,
"firmware" parameters were set in the in-core label).
So the procedure for getting the correct parameters here is the same in
all cases as it was in FreeBSD-[2-4] in the case where the fdisk table
doesn't already exist:
o ignore the "extracted" parameters here
o type in the correct parameters.
If an fdisk table already exists, then the correct parameters are the
ones used to create the table. These may be determined from one or
more of:
- your records of what you type in to create the table.
- BIOS configuration. What you typed in there, or auto-detected.
- FreeBSD[2-4] fdisk or disklabel on the whole disk. The system should
auto-detect the BIOS parameters in the same way as the BIOS.
- AnOtherOS wth non-broken fdisk on the whole disk. Might work under
emulation under FreeBSD, depending on whether the auto-detection is
in the kernel or the application. (FreeBSD puts it in the kernel
so that it doesn't need to be duplicated in utilities.)
If the fdisk table doesn't exist, then almost any parameters that
you type in can work, but parameters should be chosen for consistency
and portability. Generally, it is best to configure the parameters
in the BIOS and duplicate what you got or typed in there. Note that
fdisk(8) permits typing in unreasonable (invalid) parameters. The
fdisk in sysinstall(8) has more sanity checking, but at least in
RELENG_6 its sanity checking is insane so it gets in the way of
typing in reasonable (valid) parameters. E.g., the now-standard ATA
"firmware" geometry of 16 heads and 63 sectors/track is considered
insane for disks larger than 33GB (1GB = 10^9 bytes) since it gives
> 65536 cylinders. This was only insane many years ago when BIOSes
didn't support > 65536 (virtual) cylinders at much the same time
that BIOSes didn't support disks larger than 33GB. Now it is only
insane for old BIOSes. sysinstall also considers more than 63
sectors/ track to be insane, but newer BIOSes support up to about
255 sectors/ track. Some BIOSes even default to 255 (?) sectors/track
when they don't need to, so if sysinstall actually knows the BIOS
geometry like it does in some cases in FreeBSD[2-4], then it considers
the perfectly configured and working geometry to be insane, and "fixes"
(breaks) it to a "sane" geometry.
The parameters are irrelvant to growfs unless you need to grow a slice to
make space for growing the fs. Then the same parameters as were used to
create the slice should be used.
Bruce
More information about the freebsd-fs
mailing list