Solved How to boot existing HDD on ASRock Z77 board

  • Thread starter Deleted member 9563
  • Start date

Deleted member 9563

I just got an ASRock Z77 Extreme4 motherboard. I had thought it would boot FreeBSD since I didn't see any warnings when searching the net. Now I put it in and my disk won't boot. A fresh install is out of the question as I don't have time to deal with that for a few months. It has to boot what I have now. Is there any way to do that?

I'm running FreeBSD 10.1 Release.

I'm not happy putting my old board back in since it has less capability. Unfortunately it looks like I need to do that right away so I can get some work done. But I do hope this MB can be made useful as it was quite expensive.

PS, it seems my problem is related to this thread where I posted too.
What kind of BIOS/firmware is on this motherboard, UEFI? If it's UEFI you have to go the UEFI settings and switch to "legacy booting" (could be named differently though).
kpa thanks. Yes it is UEFI. There is no "legacy booting" as such, but under ACPI there is a possibility of enabling CSM, which I did.

wblock@ Where and when do I set that? I'm completely lost in this UEFI world, but it I do see several places where I can input. There is a "Launch EFI shell from filesystem device" option in the BIOS, and there is some kind of shell after it tries to boot.
It's a FreeBSD command. Can be used from the Shell mode of the installer disk if you can't get into the installed FreeBSD.

This is not really a UEFI or MBR thing, it's a weird standards thing.

With BIOS, one and only one MBR partition (slice) is supposed to be marked active, and the system boots from that one.

With GPT, there is a PMBR, a fake MBR that looks real to a BIOS system. The GPT spec says it will have only one partition at all, and that one will not be set active.

With these conflicting standards, you can end up with a BIOS system that can't boot because none of the partitions are set active, or a UEFI/GPT system that can't boot because one of the PMBR partitions *is* set active.

The command above sets the PMBR correctly for GPT. (Yes, I know it says "active". I can't explain the choice of name for that command.)

TL;DR: if a UEFI system refuses to boot from a GPT disk, use gpart set -a active ada0. If a BIOS system won't boot from that GPT disk, use gpart unset -a active ada0.

There are other reasons a UEFI system might not boot from GPT, but this one is fairly common.
Thanks wblock@ I'll try this from a boot disk. It does sound like my problem may be that simple. It starts FreeBSD and then fails with "Trying to mount root from ufs:/dev/ada0p2" subsequently leaving me at a prompt called "mountroot>".

PS: I'm being very careful here because if I damage the installation I've got way more work to do than I have time for. I just changed motherboard and CPU on another FreeBSD system and it rebooted without a hiccup, so I'm a little depressed over this outcome.
If you are seeing the mountroot prompt, it is booting. Generally, the mountroot error is because the entries in /etc/fstab no longer correspond to the hardware. Like the drive is seen as ad1 on this system instead of ad0. Using labels solves that problem.
If you are seeing the mountroot prompt, it is booting. Generally, the mountroot error is because the entries in /etc/fstab no longer correspond to the hardware. Like the drive is seen as ad1 on this system instead of ad0. Using labels solves that problem.

OK! Now that's making some sense to me. I can now see the /etc/fstab file and you did indeed nail the discrepancy. However, it seems like even though I mounted it read/write it's read-only. But hopefully after I get over that little hurdle, I'll be posting back with a success story. :)
That worked! I'll detail my process in case someone searching can get inspiration from it.

1/ In the BIOS, enable CSM (under advanced), and probably also disable secure boot.
2/ Boot into single user and let it go to the mountroot> prompt and type ufs:ada1p2 or whichever is now the root partition.
3/ When in a shell, type mount -o rw /.
You can get the real names of the partition by typing gpart show -l.

You can now edit /etc/fstab, but note that there is no editor there. I just renamed the existing file and used echo to put together a new one, line by line. Also, when I rebooted, there was no network, so I had to put the new interface name in /etc/rc.conf and restart networking.

There are probably better ways to do this. I also tried using the FreeBSD live disk, but could not find a way to make the HDD writable. In any case what I did was quick and easy. The fact that it took me a day to figure it out is another matter!
I usually use mount -u /, and mount /var and /usr also if they are on separate partitions. Of course, if the entries in /etc/fstab are wrong, the whole paths have to be specified in the mount command.

You wouldn't have to go through all that if FreeBSD moved on to using disk labels in fstab(5), sadly it hasn't happened yet.
Well, the installer didn't use labels last I looked. But that doesn't mean you can't add them. GPT labels are great for this. They can be added or changed at any time, and the metadata is out of the way and doesn't take any extra space. My disk setup article shows their use: Disk Setup On FreeBSD.