UFS Booting from wrong partition.

After copying an exiting FreeBSD installation from one partition to another using cp -a /part1/ /part2/ I tried booting from part2 and it seemed to work, but after running mount it showed that / was mounted on part1.
After realising I hadn't changed /etc/fstab I could understand why that happened. But after correcting /etc/fstab mount continues to show that / is mounted on part1.

Can anyone explain why? Is there some other setting under /boot which has been carried over from the copy which overides the value in fstab?
 
It "IS" expected behavior if part2 is created in behind of part1.

FreeBSD's boot code looks for bootable partition from the top to the bottom of the drive (in order of partiton number) and kicks partition boot code of the first found one.

So in your case, partition boot code of part1 is kicked.

You have 2 options here.

  • Make part1 unbootable (including deletion of the partition), or
  • Specify part2 with vfs.root.mountfrom= line in your /boot/loader.conf.
If you prefer the latter, this old thread would help.
 
At the boot menu "3. Escape to loader prompt", execute lsdev, then execute show currdev. Does it show the "part2" partition?
It shows disk0p7 which is what I want. but mount shows /dev/ada0p8!

It is actually booting from ada0p7. I changed rc.conf to show a different hostname to the one on ada0p8.

Hmmmm....
 
After realising I hadn't changed /etc/fstab I could understand why that happened. But after correcting /etc/fstab mount continues to show that / is mounted on part1.
Has the fstab entry changed by device name (/dev/ada0p7) or by GPT label (e.g. /dev/gpt/ufs2), if it is by label, check label gpart show -lp ada0.

Are there any root partition specifying settings in /boot/loader.conf ?
Code:
vfs.root.mountfrom
currdev
rootdev
 
Back
Top