Subject: Re: netbsd 2.0 no operating system
To: None <netbsd-users@netbsd.org>
From: Nenad Crnko <nc@pcmagic.net>
List: netbsd-users
Date: 04/06/2005 00:49:01
On 04/05/2005 Oliver Fuchs wrote:
> This whole thing is driving me crazy - I cannot install netbsd on my
> disk and boot it.

Something went wrong with your installation or subsequent setup. NetBSD is
perfectly capable of booting from any disk sufficiently supported by BIOS.

Before doing anything described below make sure that you have a reliable
backup of anything you can not miss from either of the disks. A finger slippage
or other force majeure may cause complete loss of all the data from both disks.

Let's make sure all the ingredients are in place. On wd0 you will neeed
a boot selector that comes from /usr/mdec/mbr_bootsel, and on disk wd1
"standard boot sector", disklabel, and bootblocks matching your file system
in NetBSD partition "a". If you have or plan to have more than one OS on wd1
you will need the bootselector on wd1 as well.

Step 1: Initialize the bootselector in mbr on disk wd0. The subject is described
        in man (8) mbr and in man (1) fdisk. Note that the following will not change
        partition information, which is located in last 4 * 16 + 2 bytes of sector 0.

           # fdisk -i wd0
  >>>      Update the bootcode from /usr/mdec/mbr? [n] y<CR>

           We haven't written the MBR back to disk yet.  This is your last chance.
  >>>      Should we write new partition table? [n] y<CR>

        This replaces the mbr boot code in sector 0 with standard bootloader.

Step 2: Reinstall bootselector from /usr/mdec/mbr_bootsel:

           # fdisk -B wd0

           Installed bootfile doesn't support required options.
  >>>      Update the bootcode from /usr/mdec/mbr_bootsel? [n] y<CR>

           Boot selector configuration:
           Timeout value (0 to 3600 seconds, -1 => never): [-1..3600 default: 10] 
           Select the default boot option. Options are:

           0: The first active partition
           1: Harddisk 0
           2: Harddisk 1
           3: Harddisk 2
  >>>      Default boot option: [0..3 default: 0] 2<CR>

           We haven't written the MBR back to disk yet.  This is your last chance.
  >>>      Should we write new partition table? [n] y<CR>

        The selection causes default boot from disk wd1.

Step 3: Examine or update the boot menu entries appearing during boot. Leave
        any partition geometry numbers unchanged:

           # fdisk -u wd0
           Disk: /dev/rwd0d
           NetBSD disklabel disk geometry:
           cylinders: 79656, heads: 16, sectors/track: 63 (1008 sectors/cylinder)
           total sectors: 80293248

           BIOS disk geometry:
           cylinders: 1024, heads: 255, sectors/track: 63 (16065 sectors/cylinder)
           total sectors: 80293248

           Do you want to change our idea of what BIOS thinks? [n] 

           Partition table:
           0: Primary DOS with 32 bit FAT (sysid 11)
               start 63, size 2104452 (1028 MB, Cyls 0-131)
           1: <UNUSED>
           2: <UNUSED>
           3: <UNUSED>
           Bootselector enabled, timeout 10 seconds.
  >>>      Which partition do you want to change?: [none] 0<CR>
           The data for partition 0 is:
           Primary DOS with 32 bit FAT (sysid 11)
               start 63, size 2104452 (1028 MB, Cyls 0-131)
           sysid: [0..255 default: 11] 
           start: [0..4998cyl default: 63, 0cyl, 0MB] 
           size: [0..4998cyl default: 2104452, 131cyl, 1028MB] 
  >>>      bootmenu: [] Win98

           Partition table:
           0: Primary DOS with 32 bit FAT (sysid 11)
               bootmenu: Win98
               start 63, size 2104452 (1028 MB, Cyls 0-131)
           1: <UNUSED>
           2: <UNUSED>
           3: <UNUSED>
           Bootselector enabled, timeout 10 seconds.
           Which partition do you want to change?: [none] 

           We haven't written the MBR back to disk yet.  This is your last chance.
           Partition table:
           0: Primary DOS with 32 bit FAT (sysid 11)
               bootmenu: Win98
               start 63, size 2104452 (1028 MB, Cyls 0-131)
           1: <UNUSED>
           2: <UNUSED>
           3: <UNUSED>
           Bootselector enabled, timeout 10 seconds.
           Should we write new partition table? [n] y

        Note that the "bootmenu" line now appears for partition 0
        You can examine the information at any time with "fdisk wd0"
        Now you are done with disk wd0.

        Once this is accomplished, you can change boot parameters
        at any time by "fdisk -B wd0"


Step 4: Make sure setup on disk wd1 is ok:

          # fdisk -i wd1
          Update the bootcode from /usr/mdec/mbr_bootsel? [n] y

          We haven't written the MBR back to disk yet.  This is your last chance.
          Should we write new partition table? [n] y

Step 5: From your message http://mail-index.netbsd.org/netbsd-users/2005/04/05/0003.html
        it appears that NetBSD disklabel is at least selfconsistent and likely to
        be correct.
        So just make sure that bootblocks are in order - see man (8) installboot
        (assuming that type of the file system on wd1a is ffsv1):

          # cp /usr/mdec/boot /boot
          # installboot /dev/rwd0a /usr/mdec/bootxx_ffsv1

        This should be enough to make wd1 bootable.

Step 6: Make sure /etc/fstab has correct entries, at least the following two:

        /dev/wd1a / ffs rw 1 1
        /dev/wd1b none swap sw 0 0
        
        Note that the device names in your setup should refer to wd1.

        Also make sure /dev/ is populated, otherwise do
          # cd /dev/
          # ./MAKEDEV all


If disk wd1 is setup correctly and wd0 is not, you should still be able
to boot from the installation cd, interrupt the loader and 
          # boot hd1a:

I hope this helps.