Running an existing installation from USB disk

I have installed FreeBSD on a laptop's internal disk and am trying to see if the same installation can be run from that disk when it is inserted in an external USB enclosure.

As it stands now it starts to boot but stops with a mountroot error. I believe that this is to do with fstab entries which mount various partitions. Originally they would have been /dev/ada0* but when booting from USB they should be /dev/da0*. Is there any way I can change these entries at boot time? i.e. by having different fstab's I can select, or is there some other way?
Last edited by a moderator:
The basic answer is to assign labels for the partitions or slices. Then you would use the labels in file /etc/fstab instead of the device identifiers. Labels won't change on different machines. Depending on whether your disk is formatted with the MBR scheme using slices or the GPT scheme using partitions, the best procedure of label assignment is different. Therefore the question, are we talking about a GPT or a MBR disk?
Last edited by a moderator:
I actually did the reverse. I had FreeBSD on a 1GB USB drive and used labels. When I was given a laptop with an 80GB internal drive I simply replaced it with the external 1GB. It worked perfectly.
I looked at gpart modify but couldn't figure out the required parameters

This my current fstab:

# Device  Mountpoint  FStype  Options Dump  Pass#
/dev/ada0p2  /  ufs  rw  1  1
/dev/ada0p3  none  swap  sw  0  0

I have no idea how it would look with labels and don't know where these labels come from...

An example would be appreciated...