mountpoint error when SATA port changed

I'm getting an error on boot if I change the SATA port for the hard drive that I originally partitioned the filesystems with and installed FreeBSD on. It drops down to a "mountpoint>" prompt, (which I'm still not sure what I'm supposed to do here). Not a problem, I can just switch the SATA cables, but why does this happen? Surely the OS can detect if a SATA port changed and then adjust to mount the root filesystem. Right?
 
You surely mean "mountroot>", not "mountpoint>".

The root file system device name set in /etc/fstab during installation (e.g. ada1p2) don't match with the device name after changing the SATA cable. fstab is read during boot. When the device names are not the same, it stops at a "mountroot>" prompt to give the user the possibility to enter a correct mountroot device. The OS doesn't adjust the root mount device on it's own (unless it's ZFS. The mountroot on ZFS is not handled by fstab).

When the system stops at a "mountroot>" prompt there is a little guide above how to proceed (with examples), named "Manual root file system specification:".

Look for the "Loader variables:" line "vfs.root.mountfrom=...." and set the correct device at the prompt. E.g. when the fstab device name for root (/) is ada1p2 and the FreeBSD disk is now the first disk, set ada0p2.

After setting the correct root mount device at the mountroot prompt, the system will stop again presenting /bin/sh, because other device names set in the fstab file don't match as well, such as the swap partition and when it's a UEFI system the ESP partition (/boot/efi).

At the shell, mount the file system read-write, edit the device names in /etc/fstab, and exit.

Or, easier, edit /etc/fstab accordingly before changing the SATA cables.

If you plan to move the SATA cabels again or the drive itself, to avoid device name problems, label the devices (partitions). See gpart(8) modify -i index [-l label] geom. The labels will be under /dev/gpt/. Set those labels for root, swap, eventually /boot/efi in /etc/fstab.

The label names can be arbitrary, but it should be something representing the device (e.g. swap0 or swapFBSD).
 
Back
Top