Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed FreeBSD 8.1 on a machine where the drive was /dev/ad6 but have moved it to a new system where the drive is now /dev/ad4. The new system boots but I need to manually specify that the root file system is on ad4s1.

How can I change the boot loader to do this automatically? Googling around turns up examples of disklabel -e being able to change the disk number, but I only get "Class not found" errors and no disk label changes with this method.

share|improve this question
/etc/disktab and bsdlabel -B? /boot/kernel.conf? – Mikel Mar 22 '11 at 3:34

I had the following scenario:

I intalled FreeBSD 10.1 USB .img file to 1GB stick and installed FreeBSD to the 16GB stick. 1GB stick was recognized as /dev/da0, and the 16GB stick as /dev/da1. FreeBSD was installed to 16GB stick under /dev/da1s2a. Then I removed 1GB stick and—normally—cannot boot to FreeBSD system automatically. The system said that cannot boot to vfs.root.mountfrom="/dev/da1s2a", but offered me to manually boot into FreeBSD, so I had to change the boot slice to /dev/da0s2a, and it worked. Off course, I don’t want to do it manually, so I found this post.

It inspired me to search for the location of variable vfs.root.mountfrom, so I remoot the system, pull out the 16GB stick, put back the 1GB stick, boot from it as a Live CD. At this point, I put back the 16GB stick, mounted it (mount /dev/da1s2a /mnt) and searched for "vfs.root.mountfrom". My findings were:

  1. DO NOT CHANGE the /boot/loader.conf file!
  2. DO NOT CHANGE the /boot/defaults/loader.conf file!

Since doing those things will mess up the loader!

The solution was to tweak the /etc/fstab on the /mnt (16GB stick) changing the entry /dev/da1s2a to /dev/da0s2a/ as the loader is looking the fstab for file systems in fstab during booting and automatically write the value of the vfs.Root.Mountfrom variable!!!

So during reboot I removed the 1GB stick and the machine successfully booted up the FreeBSD!

share|improve this answer
I installed FreeBSD on an XServe then moved the origial disk out so the drive numbers changed (ata1 to ata0). This simple solution fixed it instantly. – Allan Jan 17 at 1:16

The file /boot/loader.conf contains the instructions on which filesystem to mount as root.

Check this file for an enrty:


and tweak it (or add it if it's missing) to read:


(that is assuming partition a of slice 1 of device 4)

share|improve this answer
This was very simple, and worked for me. Thanks! – ACK_stoverflow May 16 '15 at 16:10
up vote 1 down vote accepted

Using sysinstall (Configure > Label) allowed fixing the disk label. One oddity was that the editor came up with the correct disk number (i.e. ad4), but selecting W wrote out the correct label and fixed the boot problem.

share|improve this answer

I think you want to change /boot.config.

See the boot.config man page.

It suggests you want something like

echo "1:ad(4,a)/boot/loader" > /boot.config

But cat the file first to see what /dev/ad6 is, then figure out what /dev/ad4 should be.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.