Subject: Re: big disk not bootable
To: Jeremy C. Reed <reed@reedmedia.net>
From: Wolfgang Solfrank <ws@tools.de>
List: netbsd-help
Date: 03/12/2002 15:50:14
Hi,
> fdisk says:
> # fdisk sd0
> NetBSD disklabel disk geometry:
> cylinders: 57272 heads: 32 sectors/track: 64 (2048 sectors/cylinder)
>
> BIOS disk geometry:
> cylinders: 1024 heads: 255 sectors/track: 63 (16065 sectors/cylinder)
>
> Partition table:
> 0: <UNUSED>
> 1: <UNUSED>
> 2: <UNUSED>
> 3: sysid 169 (NetBSD)
> start 64, size 117292992 (57271 MB), flag 0x80
> beg: cylinder 0, head 1, sector 1
> end: cylinder 951, head 31, sector 0
Here is the problem. The BIOS geometry (which is used for any access
to the disk via the BIOS, as in the MBR code reading the first sector
of the active (i.e. the NetBSD) partition) tells us that it has 63
sectors per track. Now the split values of the NetBSD partition tell
us that the NetBSD partition starts at cylinder 0, head 1, sector 1
(note that sectors, differing from the other values here, start at 1,
not 0). That is, the NetBSD partition starts at the first sector
(sector 1) of the second track (cylinder 0, head 1) of the disk,
which means that the first track is skipped, which has, as the
BIOS geometry told us, 63 sectors. Now the absolue values of
the NetBSD partition start tells us that the partition starts with
sector 64 (note that this value does start with 0, not 1).
So those two values are inconsistent.
Since both of these values are used at one time or another for
locating the partition boot code, this inconsistency leads to your
disk not being bootable :-(.
> I am running sysinst to see what it says:
>
> BIOS # cylinders heads sectors
> ------ ---------- ------- -------
> 0 1024 255 63
>
> The installer chose "set by hand":
> cylinders: 57272
> heads: 32
> sectors: 64
That's the problem. He shouldn't have messed with the BIOS geometry
at all. It would be ok though to use those values for the NetBSD
geometry.
> Now, I see that sysinst says: "If you have the BIOS set up to use > 1024
> cylinders just truncate that number to 1024 here." So he should have set
> it to "1024".
Since the end of the partition in the fdisk partition table isn't used
by NetBSD at all, this shouldn't be a problem.
> Also, I wonder why it is 57272 MB instead of 60054 MB.
That's just an artifact of using 1k=1024 vs. 1k=1000 or 1M=1024*1024
vs. 1M=1000000. I.e. you've got 117293056 sectors a 512 bytes
which gives 60054044672 bytes. If using the decimal division this
is just a bit beyond 60054 MB. If using the binary division it
is 58646528 KB (= 60054044672/1024) or 57272 MB (= 58646528/1024).
> Can I change the geometry while it is live without reinstalling?
Hmm, I'm not sure whether the following would work, but you could
give it a try (note NO GUARRANTEE for not loosing your data though!!!):
1. Back up at least sd0a (you did back up all your data anyway,
didn't you?), as that partition will definitely be lost.
2. Note the disklabel output somewhere.
3. Run fdisk and change the start of the NetBSD partition to sector 63.
4. Run disklabel and reenter the data saved in step 2 above, but change
the start of partitions a and c to 63 and increment their sizes by
one sector.
5. Restore the data for partition a from the backup done in step 1 above.
6. Run "installboot -f /usr/mdec/biosboot.sym /dev/sd0a" to install
the NetBSD partition boot code onto the NetBSD partition.
At least in theory this should give you a bootable disk. If it doesn't
work, you are probably lost and have to reinstall the system.
Hope it helps.
Ciao,
Wolfgang
--
ws@TooLs.DE Wolfgang Solfrank, TooLs GmbH +49-228-985800