View Single Post
  #4   (View Single Post)  
Old 21st May 2008
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

Let's step back, then, and first look at the boot process. Simplified:
  1. Your BIOS selects a drive to boot.
  2. The BIOS loads and executes a boot record from the drive, either a master boot record (MBR) or a partition boot record (PBR). OpenBSD uses a PBR. This is the "first stage" boot loader.
  3. The PBR program loads the "second stage" boot loader. For OpenBSD, the second stage boot loader is the program that issues the boot> prompt, allowing you to select and load a kernel, define your root partition, make kernel configuration changes, and transfer control to a kernel that has been loaded. The man page I pointed you to above describes this program in detail, and that is why I recommended it.
  4. When the second stage boot loader turns over control to a kernel, the kernel performs hardware discovery. It is at this point that device numbers are assigned to disk drives. This assignment is ordered by the order of drives returned by the discovery proces. This will not change, boot after boot, but will be affected by hardware or BIOS changes you make. As the kernel inspects the hardware configuration, it outputs information to the console in blue (your "dmesg"), then turns control over to init(8).
  5. The init(8) program will drop the console into a shell if booted in single-user mode. If in multi-user mode, it will run your /etc/rc script.
  6. /etc/rc will issue a mount -a, which will read your mount point configuration from /etc/fstab and attempt to mount every partition listed there that is not configured with "noauto" as an option.
With that background in mind:
  • You are responsible for figuring out how to tell your computer which physical drive to load an MBR/PBR program from. You may be able to select the device from a BIOS configuration menu. You have stated that you cannot. However, this has nothing to do with the OS you are running. You would have this same problem no matter if you were running Windows, Linux, or something else entirely.
  • If you are able to boot a drive containing a properly configured OpenBSD PBR pointing to a proper second stage boot loader, you should get a boot> prompt. It will not matter what drive type or drive number it is.
  • At that boot> prompt, you can type "machine diskinfo" to get a list of all the drives it knows about. It won't matter if they are SATA, PATA, SCSI... each can be addressed by a unique drive number: hd0, hd1, hd2, hd3, etc.
  • At that boot> prompt, you can issue a "boot" command which points to a particular kernel ... on the same drive or on any other drive listed by the "machine diskinfo" command. You can hunt for kernels and OpenBSD disklabel partitions with the "ls" command, if necessary.
  • By default, if you wait 5 seconds after seeing the boot> prompt, the boot loader will attempt to find a kernel: it will first try to find "/bsd" in the "a" partition of the drive that was booted ... regardless of number. If if fails, it will look for "/obsd" in the same paritition, then it will give up. If it finds a kernel, it will load it and boot it in multi-user mode.
  • I recommended booting in single-user mode because your disk numbers have changed. Your /etc/fstab entries will need to be changed, as your boot disk is no longer wd0, so all entries in /etc/fstab pointing to wd0 will need to be changed.
Assuming you can get to a boot> prompt, all you should need to do is type "-s" and press the Enter key. The second stage boot loader will look for /bsd in the "a" partition of your boot drive, load the kernel, and pass control to it. It will discover your hardware, pass control to init(8), which will ask you if the bourne shell ("sh") is ok, and you can press the Enter key again. It will ask you your terminal type, and you can type "vt220" and press the Enter key. You will have a super user shell prompt: "#"

At this point, you will need to figure out what device you have booted, and manually mount partitions, and then edit your /etc/fstab to point to that device. You will need to mount your root partition "/", and depending on how you have partitioned OpenBSD, you will need to mount "/usr" and perhaps "/var" in order to use a text editor such as vi(1) or mg(1).
Reply With Quote