# Running an existing installation from USB disk



## balanga (Feb 14, 2016)

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?


----------



## obsigna (Feb 14, 2016)

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?


----------



## tobik@ (Feb 14, 2016)

For MBR with UFS see http://www.wonkity.com/~wblock/docs/html/labels.html. GPT labels can be assigned with `gpart modify` (see gpart(8)).


----------



## pwr2srv (Feb 16, 2016)

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.


----------



## balanga (Mar 7, 2016)

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...


----------



## balanga (Mar 7, 2016)

Replying to my own post...

https://www.freebsd.org/doc/handbook/geom-glabel.html


----------

